reader

package
v2.0.0-...-e9c7f1d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Time    time.Time
	Action  string
	Package string
	Test    string
	Elapsed float64 // seconds
	Output  string
}

Event represents a JSON event emitted by `go test -json`.

type JSONEventReader

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

JSONEventReader reads JSON events from an io.Reader object.

func NewJSONEventReader

func NewJSONEventReader(r io.Reader) *JSONEventReader

NewJSONEventReader returns a JSONEventReader to read the data in JSON events from r.

func (*JSONEventReader) ReadLine

func (r *JSONEventReader) ReadLine() (string, *Metadata, error)

ReadLine returns the next line from the underlying reader.

type LimitedLineReader

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

LimitedLineReader reads lines from an io.Reader object with a configurable line size limit. Lines exceeding the limit will be truncated, but read completely from the underlying io.Reader.

func NewLimitedLineReader

func NewLimitedLineReader(r io.Reader, limit int) *LimitedLineReader

NewLimitedLineReader returns a LimitedLineReader to read lines from r with a maximum line size of limit.

func (*LimitedLineReader) ReadLine

func (r *LimitedLineReader) ReadLine() (string, *Metadata, error)

ReadLine returns the next line from the underlying reader. The length of the line will not exceed the configured limit. ReadLine either returns a line or it returns an error, never both.

type LineReader

type LineReader interface {
	ReadLine() (string, *Metadata, error)
}

LineReader is an interface to read lines with optional Metadata.

type Metadata

type Metadata struct {
	Package string
}

Metadata contains metadata that belongs to a line.

Jump to

Keyboard shortcuts

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