tools

package
v0.16.18 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(dir string) error

EnsureDir ensures that a target directory exists (like `mkdir -p`), returning a non-nil error if any problem occurs.

func EnsureFileDir

func EnsureFileDir(path string) error

EnsureFileDir ensures that a target file's parent directory exists, returning a non-nil error if any problem occurs.

Types

type GenWriter

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

GenWriter adds some convenient helpers atop a buffered writer.

func NewGenWriter

func NewGenWriter(tool string, file string) (*GenWriter, error)

func (*GenWriter) Buffer

func (g *GenWriter) Buffer() string

Buffer returns whatever has been written to the in-memory buffer (in non-file cases).

func (*GenWriter) Close

func (g *GenWriter) Close() error

Close flushes and closes the underlying writer.

func (*GenWriter) EmitHeaderWarning

func (g *GenWriter) EmitHeaderWarning(commentChars string)

EmitHeaderWarning emits the standard "WARNING" into a generated file, prefixed by commentChars.

func (*GenWriter) Flush

func (g *GenWriter) Flush() error

Flush explicitly flushes the writer's pending writes.

func (*GenWriter) WriteString added in v0.15.1

func (g *GenWriter) WriteString(msg string)

WriteString writes the provided string to the underlying buffer _without_ formatting it.

func (*GenWriter) Writefmt

func (g *GenWriter) Writefmt(msg string, args ...interface{})

Writefmt wraps the bufio.Writer.WriteString function, but also performs fmt.Sprintf-style formatting.

func (*GenWriter) Writefmtln

func (g *GenWriter) Writefmtln(msg string, args ...interface{})

Writefmtln wraps the bufio.Writer.WriteString function, performing fmt.Sprintf-style formatting and appending \n.

Jump to

Keyboard shortcuts

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