...
Package composite
import "cmd/vendor/golang.org/x/tools/go/analysis/passes/composite"
- Overview
- Index
Package composite defines an Analyzer that checks for unkeyed
composite literals.
Constants
const Doc = `check for unkeyed composite literals
This analyzer reports a diagnostic for composite literals of struct
types imported from another package that do not use the field-keyed
syntax. Such literals are fragile because the addition of a new field
(even if unexported) to the struct will cause compilation to fail.
As an example,
err = &net.DNSConfigError{err}
should be replaced by:
err = &net.DNSConfigError{Err: err}
`
Variables
var Analyzer = &analysis.Analyzer{
Name: "composites",
Doc: Doc,
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/composite",
Requires: []*analysis.Analyzer{inspect.Analyzer},
RunDespiteErrors: true,
Run: run,
}