utils

package
v0.0.0-...-95e0958 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntMax

func IntMax(x, y int) int

IntMax returns the maximum of given two integers.

func IntMaxReduce

func IntMaxReduce(xs []int, init int) int

IntMaxReduce returns the maximum integer in given sequence and given number.

func IntMin

func IntMin(x, y int) int

IntMin returns the minimum of given two integers.

func IntSum

func IntSum(xs []int) int

IntSum computes the sum of given integers. Returns zero if input is empty.

func ReadLines

func ReadLines(src io.Reader) ([]string, error)

ReadLines reads all lines from given reader as an array. Newline characters are removed.

Types

type ErrWriter

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

ErrWriter does buffered output with deferred error check.

func NewErrWriter

func NewErrWriter(writer io.Writer) *ErrWriter

NewErrWriter creates a new ErrWriter that writes to given Writer.

func (*ErrWriter) Err

func (ewriter *ErrWriter) Err() error

Err returns error occurred on previous operations.

func (*ErrWriter) Flush

func (ewriter *ErrWriter) Flush()

Flush flushes the internal buffer. It does nothing if Err is not nil.

func (*ErrWriter) WriteString

func (ewriter *ErrWriter) WriteString(str string)

WriteString writes given string. It does nothing if Err is not nil.

Jump to

Keyboard shortcuts

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