nilaway icon indicating copy to clipboard operation
nilaway copied to clipboard

Static analysis tool to detect potential nil panics in Go code

Results 116 nilaway issues
Sort by recently updated
recently updated
newest added

``` func test(s []*int) { s = append(s, nil) s[len(s)-1] = new(int) } ```

false positive

Code sample: ```golang package main import ( "encoding/json" "fmt" ) func main() { var outMap map[string]any if err := json.Unmarshal([]byte("{}"), &outMap); err != nil { println(fmt.Sprint("err: ", err)) return }...

library-modeling

_Note: Fully recognize that this may wind up being an unacceptable ask based on the amount of inspection or Facts needed to be surfaced by the static analyzer._ Within our...

``` type S struct { Field *int } func f1() *S { s := &S{} s.Field = nil return s } func f2() { s := &S{Field: new(int)} return s...

enhancement

I believe that there is a false positive that occurs when a receiver that correctly handles Nil is assigned to an interface. I'm including a slightly more verbose code sample...

Below tests cases are reporting a false positive error: Potential nil panic detected. Observed nil flow from source to dereference point: - line1: unassigned variable `stack` returned from `foo()` in...

false positive