here

package
v0.204.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package here provides creation of here-documents from raw strings.

Golang supports raw-string syntax.

doc := `
	Foo
	Bar
`

But raw-string cannot recognize indentation. Thus such content is an indented string, equivalent to

"\n\tFoo\n\tBar\n"

I dont't want this!

However this problem is solved by package heredoc.

doc := here.Doc(`
	Foo
	Bar
`)

Is equivalent to

"Foo\nBar\n"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(raw string) []byte

Bytes returns un-indented byte array from the provided here-document.

func Doc

func Doc(raw string) string

Doc returns un-indented string as here-document.

func Docf

func Docf(raw string, args ...interface{}) string

Docf returns unindented and formatted string as here-document. Formatting is done as for fmt.Printf().

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL