nilaway
nilaway copied to clipboard
Static analysis tool to detect potential nil panics in Go code
NilAway reports a false positive in the below example. It is incorrectly making an association between the two invocations of `foo` in `bar` and `testFoo`. ``` L91. func foo(p *int)...
Affiliations analysis fails to capture nested composite literal for slice type. It does not report any error for the below test case. ``` type A1 struct{} func (A1) foo(x *int)...
NilAway currently does not handle anonymous functions in the affiliation analysis. Now with the anonymous function support added in NilAway (under a feature flag), we should extend to support this...
Implement special handling for `init`. Below is an example where a false positive is reported. ``` var _x *int func init() { _x = new(int) } func test() { _...
Currently, our inference algorithm requires that the evaluation order of triggers and sites be ordered to have deterministic error generations. Consider the following example: ``` func f1(p *int) { //...
We have defined `annotation.Prestring` in our codebase which is equivalent to `fmt.Stringer`. We should remove this redundant definition and directly use `fmt.Stringer` instead.
Go exposes "abnormal" control flow primitives, such as the following - defer - panic - recover - os.Exit - log.Fatal Currently, NilAway reports false positives in these cases. We must...
For code example below, ``` func foo(x *int) { x = nil y := x z := y print(*z) // L30. Error reported here } ``` NilAway prints the error...
Thrift/Protobuf protocols used extensively in enterprise settings. They are implemented as code generators in Go. When analyzing the generated code, NilAway does not know if some fields are nilable/nonnil. We...
We can report errors on `pkg A` when we are analyzing `pkg B` due to our multi-pkg inference. However, nogo’s support for nolint comments is based on reading the AST...