hereduck

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: GPL-3.0 Imports: 4 Imported by: 2

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func D

func D(str string) string

D strips leading indentation from a string. The minimum indentation level shared by all lines is removed, but any subsequent indentation is preserved.

func Df

func Df(format string, a ...interface{}) string

Df is like D but also follows the standard formatting string pattern.

Types

This section is empty.

Jump to

Keyboard shortcuts

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