heredoc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MPL-2.0, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package heredoc 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 := heredoc.Doc(`
	Foo
	Bar
`)

Is equivalent to

"Foo\nBar\n"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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().

func String

func String(raw string) string

String returns un-indented string as here-document. String is an alias of Doc

Types

This section is empty.

Jump to

Keyboard shortcuts

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