report

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryError entryKind = iota
	EntryWarning
	EntryInfo
	EntryDeprecated
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Kind      entryKind `json:"kind"`
	Message   string    `json:"message"`
	Line      int       `json:"line,omitempty"`
	Column    int       `json:"column,omitempty"`
	Highlight string    `json:"-"`
}

func (Entry) String

func (e Entry) String() string

type Report

type Report struct {
	Entries []Entry
}

func ReportFromError

func ReportFromError(err error, severity entryKind) Report

func (*Report) Add

func (r *Report) Add(e Entry)

func (*Report) AddPosition

func (r *Report) AddPosition(line, col int, highlight string)

AddPosition updates all the entries with Line equal to 0 and sets the Line/Column fields to line/column. This is useful for when a type has a custom unmarshaller and thus can't determine an exact offset of the error with the type. In this case the offset for the entire chunk of json that got unmarshalled to the type can be used instead, which is still pretty good.

func (Report) IsDeprecated

func (r Report) IsDeprecated() bool

IsDeprecated returns if the report has deprecations

func (Report) IsFatal

func (r Report) IsFatal() bool

IsFatal returns if there were any errors that make the config invalid

func (*Report) Merge

func (into *Report) Merge(from Report)

func (*Report) Sort

func (r *Report) Sort()

Sort sorts the entries by line number, then column number

func (Report) String

func (r Report) String() string

Jump to

Keyboard shortcuts

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