tool

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineErrors

func CombineErrors(err1, err2 error) error

CombineErrors reports the first non-nil error in the list.

Types

type File

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

File wraps an output, and handles various details with tool output, such as possibly directing output to standard out, and deleting an incomplete output file if there was an error.

func Open

func Open(filename string) (File, error)

Open create a new Writer, directing output to standard out if the filename is "-".

func (*File) Close

func (w *File) Close() error

Closes the underlying file, but only if the file is owned by the File. Close will possibly remove the output file if there was an error (see Keep).

func (*File) File

func (w *File) File() *os.File

File returns the underlying file.

func (*File) Keep

func (w *File) Keep(err error)

Keep flags the output file as complete if err is nil. If not called, or if err is not nil, the file will be remove when closed.

Jump to

Keyboard shortcuts

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