ioutil

package
v2.13.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 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 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 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.

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 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