Denis Isaev 8c1237b667 Use the newest go vet
The newest go vet based on go/analysis
2019-03-17 23:12:44 +03:00

33 lines
750 B
Go

//args: -Egovet
//config: linters-settings.govet.check-shadowing=true
package testdata
import (
"io"
"os"
)
func Govet() error {
return &os.PathError{"first", "path", os.ErrNotExist} // ERROR "composites: `os.PathError` composite literal uses unkeyed fields"
}
func GovetShadow(f io.Reader, buf []byte) (err error) {
if f != nil {
_, err := f.Read(buf) // ERROR "shadow: declaration of .err. shadows declaration at line \d+"
if err != nil {
return err
}
}
// Use variable to trigger shadowing error
_ = err
return
}
func GovetNolintVet() error {
return &os.PathError{"first", "path", os.ErrNotExist} //nolint:vet
}
func GovetNolintVetShadow() error {
return &os.PathError{"first", "path", os.ErrNotExist} //nolint:vetshadow
}