package nilness
import "honnef.co/go/tools/analysis/facts/nilness"
Index ¶
Variables ¶
var Analysis = &analysis.Analyzer{ Name: "nilness", Doc: "Annotates return values that will never be nil (typed or untyped)", Run: run, Requires: []*analysis.Analyzer{buildir.Analyzer}, FactTypes: []analysis.Fact{(*neverReturnsNilFact)(nil)}, ResultType: reflect.TypeOf((*Result)(nil)), }
Types ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) MayReturnNil ¶
MayReturnNil reports whether the ret's return value of fn might be a typed or untyped nil value. The value of ret is zero-based. When globalOnly is true, the only possible nil values are global variables.
The analysis has false positives: MayReturnNil can incorrectly report true, but never incorrectly reports false.
Source Files ¶
nilness.go
- Version
- v0.6.1 (latest)
- Published
- Mar 5, 2025
- Platform
- darwin/amd64
- Imports
- 8 packages
- Last checked
- 2 hours ago –
Tools for package owners.