Documentation ΒΆ
Overview ΒΆ
Package errorformat provides 'errorformat' functionality of Vim. :h errorformat
Index ΒΆ
Examples ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Efm ΒΆ
type Efm struct {
// contains filtered or unexported fields
}
Efm represents a errorformat.
type Entry ΒΆ
type Entry struct { // name of a file Filename string // line number Lnum int // column number (first column is 1) Col int // true: "col" is visual column // false: "col" is byte index Vcol bool // error number Nr int // search pattern used to locate the error Pattern string // description of the error Text string // type of the error, 'E', '1', etc. Type rune // true: recognized error message Valid bool // Original error lines (often one line. more than one line for multi-line // errorformat. :h errorformat-multi-line) Lines []string }
Entry represents matched entry of errorformat, equivalent to Vim's quickfix list item.
type Errorformat ΒΆ
type Errorformat struct {
Efms []*Efm
}
Errorformat provides errorformat feature.
Example ΒΆ
package main import ( "fmt" "strings" "github.com/reviewdog/errorformat" ) func main() { in := ` golint.new.go:3:5: exported var V should have comment or be unexported golint.new.go:5:5: exported var NewError1 should have comment or be unexported golint.new.go:7:1: comment on exported function F should be of the form "F ..." golint.new.go:11:1: comment on exported function F2 should be of the form "F2 ..." ` efm, _ := errorformat.NewErrorformat([]string{`%f:%l:%c: %m`, `%-G%.%#`}) s := efm.NewScanner(strings.NewReader(in)) for s.Scan() { fmt.Println(s.Entry()) } }
Output: golint.new.go|3 col 5| exported var V should have comment or be unexported golint.new.go|5 col 5| exported var NewError1 should have comment or be unexported golint.new.go|7 col 1| comment on exported function F should be of the form "F ..." golint.new.go|11 col 1| comment on exported function F2 should be of the form "F2 ..."
func NewErrorformat ΒΆ
func NewErrorformat(efms []string) (*Errorformat, error)
NewErrorformat compiles given errorformats string (efms) and returns a new Errorformat. It returns error if the errorformat is invalid.
func (*Errorformat) NewScanner ΒΆ
func (errorformat *Errorformat) NewScanner(r io.Reader) *Scanner
NewScanner returns a new Scanner to read from r.
type Match ΒΆ
type Match struct { F string // (%f) file name N int // (%n) error number L int // (%l) line number C int // (%c) column number T byte // (%t) error type M string // (%m) error message R string // (%r) the "rest" of a single-line file message P string // (%p) pointer line V int // (%v) virtual column number S string // (%s) search text }
Match represents match of Efm. ref: Basic items in :h errorformat
type Scanner ΒΆ
type Scanner struct { *Errorformat // contains filtered or unexported fields }
Scanner provides a interface for scanning compiler/linter/static analyzer result using Errorformat.
Directories ΒΆ
Path | Synopsis |
---|---|
cmd
|
|
Package fmts holds defined errorformats.
|
Package fmts holds defined errorformats. |
Package writer provides error result writers.
|
Package writer provides error result writers. |
Click to show internal directories.
Click to hide internal directories.