util

package
v0.0.0-...-8e52100 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrefixPaths

func PrefixPaths(prefix string, paths ...string) []string

PrefixPaths add prefixes from prefix to every path in paths

Types

type PrefixWriter

type PrefixWriter struct {
	// contains filtered or unexported fields
}

PrefixWriter implements the io.Writer interface and adds a prefix to every written line

func NewPrefixWriter

func NewPrefixWriter(w io.Writer, prefix []byte) *PrefixWriter

NewPrefixWriter creates and initializes a new PrefixWriter

func (*PrefixWriter) Write

func (w *PrefixWriter) Write(buf []byte) (int, error)

Write adds a prefix to every line in buf and writes it to the underlying io.Writer

type SeqWriter

type SeqWriter struct {
	// contains filtered or unexported fields
}

SeqWriter counts and checks a sequence of writes for errors.

If a write to the underlying io.Writer returns an error, SeqWriter records it and ignores every further Write.

func NewSeqWriter

func NewSeqWriter(w io.Writer) *SeqWriter

NewSeqWriter creates and initializes a new SeqWriter

func (*SeqWriter) Done

func (s *SeqWriter) Done() (int64, error)

Done resets and returns the number of written bytes and/or an error

func (*SeqWriter) Write

func (s *SeqWriter) Write(buf []byte) (int, error)

Write writes buf to the underlying Writer if there was no previous error and and records the number of written bytes and a possible error

Jump to

Keyboard shortcuts

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