Help us shape the future of Go! Take the 2026 Go Developer Survey

indent

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 4 Imported by: 98

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte, indent uint) []byte

Bytes is shorthand for declaring a new default indent-writer instance, used to immediately indent a byte slice.

func String

func String(s string, indent uint) string

String is shorthand for declaring a new default indent-writer instance, used to immediately indent a string.

Types

type IndentFunc

type IndentFunc func(w io.Writer)

type Writer

type Writer struct {
	Indent     uint
	IndentFunc IndentFunc
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(indent uint, indentFunc IndentFunc) *Writer

func NewWriterPipe

func NewWriterPipe(forward io.Writer, indent uint, indentFunc IndentFunc) *Writer

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

Bytes returns the indented result as a byte slice.

func (*Writer) String

func (w *Writer) String() string

String returns the indented result as a string.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write is used to write content to the indent buffer.

Jump to

Keyboard shortcuts

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