Documentation ¶
Overview ¶
Package fillstruct defines an Analyzer that automatically fills in a struct declaration with zero value elements for each field.
The analyzer's diagnostic is merely a prompt. The actual fix is created by a separate direct call from gopls to the SuggestedFixes function. Tests of Analyzer.Run can be found in ./testdata/src. Tests of the SuggestedFixes logic live in ../../testdata/fillstruct.
Index ¶
Constants ¶
const FixCategory = "fillstruct" // recognized by gopls ApplyFix
Variables ¶
This section is empty.
Functions ¶
func Diagnose ¶
func Diagnose(f *ast.File, start, end token.Pos, pkg *types.Package, info *types.Info) []analysis.Diagnostic
Diagnose computes diagnostics for fillable struct literals overlapping with the provided start and end position of file f.
The diagnostic contains a lazy fix; the actual patch is computed (via the ApplyFix command) by a call to SuggestedFix.
If either start or end is invalid, the entire file is inspected.
Types ¶
This section is empty.