uber-go / nilaway

Static analysis tool to detect potential nil panics in Go code
Apache License 2.0
3.19k stars 66 forks source link

Add support for rich effect functions via function pointers #277

Open sonalmahajan15 opened 2 months ago

sonalmahajan15 commented 2 months ago

NilAway currently does not recognize function pointers as valid rich check effect functions, thereby reporting false positives.

type S struct {
    f func() (*int, error)
}

func testme(s *S) {
    v, err := s.f()
    if err != nil {
        return
    }
    _ = *v // FP: unassigned variable `v` dereferenced
}