ioutil

package
v2.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempName added in v2.12.0

func CreateTempName(dir, pattern string) (string, error)

CreateTempName creates a new temporary file using os.CreateTemp, removes it, and then returns its name.

func Print added in v2.16.0

func Print(out io.Writer, txt string) int

Print is like Fprint but panics on error.

func Printf

func Printf(out io.Writer, format string, args ...any) int

Printf is like Fprintf but panics on error.

func Println

func Println(out io.Writer, txt string) int

Println is like Fprintln but panics on error.

func SafeName added in v2.18.0

func SafeName(name string) string

SafeName returns a string that can safely be used as a file name or docker container. Only characters [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed. Others are replaced by an underscore, or if it's the very first character, by the character 'a'.

func WriteAllTo

func WriteAllTo(out io.Writer, wts ...io.WriterTo) (tn int64, err error)

WriteAllTo calls WriteTo on all elements of the WriterTo slice and returns the total number of bytes written.

func WriteString added in v2.9.3

func WriteString(out io.Writer, s string) int

WriteString is like io.WriteString but panics on error.

func WriterToString added in v2.13.2

func WriterToString(wt func(w io.Writer) (int64, error)) string

Types

type KeyValueFormatter added in v2.9.3

type KeyValueFormatter struct {
	Prefix    string
	Indent    string
	Separator string
	// contains filtered or unexported fields
}

KeyValueFormatter will format each key/value pair added by Add so that they are prefixed with Prefix and have a vertically aligned ':' between the key and the value. Each pair is separated by a newline, and if a value contains newlines, then each line in that value, except the first one will be prefixed with `Prefix`, and Indent.

func DefaultKeyValueFormatter added in v2.9.3

func DefaultKeyValueFormatter() *KeyValueFormatter

func (*KeyValueFormatter) Add added in v2.9.3

func (f *KeyValueFormatter) Add(k, v string)

Add adds a key value pair that will be included in the formatted output.

func (*KeyValueFormatter) Println added in v2.12.0

func (f *KeyValueFormatter) Println(out io.Writer) int

func (*KeyValueFormatter) String added in v2.9.3

func (f *KeyValueFormatter) String() string

String returns the formatted output string.

func (*KeyValueFormatter) WriteTo added in v2.9.3

func (f *KeyValueFormatter) WriteTo(out io.Writer) (int64, error)

WriteTo writes the formatted output to the given io.Writer.

type KeyValueProvider added in v2.18.0

type KeyValueProvider interface {
	AddTo(*KeyValueFormatter)
}

type WriterTos

type WriterTos interface {
	WriterTos() []io.WriterTo
}

WriterTos implements something that can be represented as a list of io.WriterTo.

Jump to

Keyboard shortcuts

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