Imports #
_ "embed"
"go/ast"
"go/types"
"strings"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
"golang.org/x/tools/go/ast/inspector"
_ "embed"
"go/ast"
"go/types"
"strings"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
"golang.org/x/tools/go/ast/inspector"
var Analyzer = *ast.UnaryExpr
canonicalMethods lists the input and output types for Go methods that are checked using dynamic interface checks. Because the checks are dynamic, such methods would not cause a compile error if they have the wrong signature: instead the dynamic check would fail, sometimes mysteriously. If a method is found with a name listed here but not the input/output types listed here, vet complains. A few of the canonical methods have very common names. For example, a type might implement a Scan method that has nothing to do with fmt.Scanner, but we still want to check the methods that are intended to implement fmt.Scanner. To do that, the arguments that have a = prefix are treated as signals that the canonical meaning is intended: if a Scan method doesn't have a fmt.ScanState as its first argument, we let it go. But if it does have a fmt.ScanState, then the rest has to match.
var canonicalMethods = map[string]struct{...}{...}
go:embed doc.go
var doc string
var errorType = *ast.TypeAssertExpr
func argjoin(x []string) string
func canonicalMethod(pass *analysis.Pass, id *ast.Ident)
func implementsError(actual types.Type) bool
Does this one type match?
func matchParamType(expect string, actual types.Type) bool
Does each type in expect with the given prefix match the corresponding type in actual?
func matchParams(pass *analysis.Pass, expect []string, actual *types.Tuple, prefix string) bool
func run(pass *analysis.Pass) (interface{}, error)
func typeString(typ types.Type) string
Generated with Arrow