Skip to content

crdx/hereduck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hereduck

hereduck is a heredoc library for Go.

Installation

go get crdx.org/hereduck

Usage

import "crdx.org/hereduck"

func main() {
    doc = hereduck.D(`
        Hello
            world
    `)
}

This would result in the following string in doc, including the trailing new line.

Hello
    world

The minimum indentation level shared by all lines is stripped out, but subsequent indentation is preserved.

There is also hereduck.Df which follows the standard formatting string pattern.

Contributions

Open an issue or send a pull request.

Licence

GPLv3.