Documentation
¶
Overview ¶
Package structinit implements the struct initialization syntactic analysis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReportResults ¶
func ReportResults(res AnalysisResult) (string, bool)
ReportResults writes res to a string and returns true if the analysis should fail.
Types ¶
type AnalysisResult ¶
type AnalysisResult struct {
// InitInfos is a mapping from the named struct type to its initialization
// information.
InitInfos map[*types.Named]InitInfo
}
AnalysisResult is the result of the struct-init analysis.
type InitInfo ¶
type InitInfo struct {
// Tag is the tag of the problem this initinfo corresponds to
Tag string
// ZeroAllocs is a list of the zero-value allocations of the struct.
ZeroAllocs []ZeroAlloc
// InvalidWrites is a mapping of the struct field to all the invalid writes
// to that field.
InvalidWrites map[*types.Var][]InvalidWrite
// contains filtered or unexported fields
}
InitInfo is the initialization information for a struct.
type InvalidWrite ¶
type InvalidWrite struct {
// Got is the value actually written.
Got ssa.Value
// Want is the configured value that should have been written.
Want ssa.Value
// Instr is the instruction performing the write.
Instr ssa.Instruction
// Pos is the position of the instruction.
Pos token.Position
}
InvalidWrite is a write to a field of the struct of value Got that is not the configured value (Want).
Click to show internal directories.
Click to hide internal directories.