github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/stylecheck/testdata/src/CheckErrorVarNames/CheckErrorVarNames.go (about)

     1  // Package pkg ...
     2  package pkg
     3  
     4  import (
     5  	"errors"
     6  	"fmt"
     7  )
     8  
     9  var (
    10  	foo                   = errors.New("") // MATCH "error var foo should have name of the form errFoo"
    11  	errBar                = errors.New("")
    12  	qux, fisk, errAnother = errors.New(""), errors.New(""), errors.New("")
    13  	abc                   = fmt.Errorf("") // MATCH "error var abc should have name of the form errFoo"
    14  
    15  	errAbc = fmt.Errorf("")
    16  )
    17  
    18  var wrong = errors.New("") // MATCH "error var wrong should have name of the form errFoo"
    19  
    20  var result = fn()
    21  
    22  func fn() error { return nil }
    23  
    24  // MATCH:12 "error var qux should have name of the form errFoo"
    25  // MATCH:12 "error var fisk should have name of the form errFoo"