Documentation ¶
Index ¶
- func CreateTempName(dir, pattern string) (string, error)
- func Print(out io.Writer, txt string) int
- func Printf(out io.Writer, format string, args ...any) int
- func Println(out io.Writer, txt string) int
- func WriteAllTo(out io.Writer, wts ...io.WriterTo) (tn int64, err error)
- func WriteString(out io.Writer, s string) int
- func WriterToString(wt func(w io.Writer) (int64, error)) string
- type KeyValueFormatter
- type WriterTos
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTempName ¶ added in v2.12.0
CreateTempName creates a new temporary file using os.CreateTemp, removes it, and then returns its name.
func WriteAllTo ¶
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
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.