...
Package errorsas
import "cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas"
- Overview
- Index
Package errorsas defines an Analyzer that checks that the second argument to
errors.As is a pointer to a type implementing error.
Constants
const Doc = `report passing non-pointer or non-error values to errors.As
The errorsas analyzer reports calls to errors.As where the type
of the second argument is not a pointer to a type implementing error.
For example:
var unwrappedErr net.DNSError
errors.As(err, unwrappedErr) // should use &unwrappedErr, DNSError.Error has a pointer receiver
`
Variables
var Analyzer = &analysis.Analyzer{
Name: "errorsas",
Doc: Doc,
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/errorsas",
Requires: []*analysis.Analyzer{typeindexanalyzer.Analyzer},
Run: run,
}