github.com/golangCi/golangCi-lint@v1.10.1/test/testdata/govet.go (about) 1 // args: -Egovet --govet.check-shadowing=true 2 package testdata 3 4 import ( 5 "io" 6 "os" 7 ) 8 9 func Govet() error { 10 return &os.PathError{"first", "path", os.ErrNotExist} // ERROR "`os.PathError` composite literal uses unkeyed fields" 11 } 12 13 func GovetShadow(f io.Reader, buf []byte) (err error) { 14 if f != nil { 15 _, err := f.Read(buf) // ERROR "declaration of .err. shadows declaration at testdata/govet.go:\d+" 16 if err != nil { 17 return err 18 } 19 } 20 // Use variable to trigger shadowing error 21 _ = err 22 return 23 }