github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/test/testdata/gochecknoglobals.go (about) 1 //golangcitest:args -Egochecknoglobals 2 package testdata 3 4 import ( 5 "errors" 6 "fmt" 7 "regexp" 8 ) 9 10 var noGlobalsVar int // want "noGlobalsVar is a global variable" 11 var ErrSomeType = errors.New("test that global erorrs aren't warned") 12 13 var ( 14 OnlyDigites = regexp.MustCompile(`^\d+$`) 15 BadNamedErr = errors.New("this is bad") // want "BadNamedErr is a global variable" 16 ) 17 18 func NoGlobals() { 19 fmt.Print(noGlobalsVar) 20 }