You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ nilaway ./main.go/home/dross/minimal/main.go:28:5: error: Potential nil panic detected. Observed nil flow from source to dereference point: -> minimal/main.go:15:25: result 0 of `process()` lacking guarding; passed as arg `thing` to `process()` -> minimal/main.go:28:5: function parameter `thing` accessed field `field`
If I replace the loop with two successive calls, it's fine with it:
Note, replacing the switch with an if/else also reproduces the error, as does an if with no else.
The text was updated successfully, but these errors were encountered:
daboross
changed the title
nilaway doesn't detect guard on err variable reused in loop
nilaway doesn't detect guard on err variable reused in loop when assignment happens in if
Nov 17, 2023
daboross
changed the title
nilaway doesn't detect guard on err variable reused in loop when assignment happens in if
nilaway doesn't detect guard on err variable reused in loop when assignment happens in case
Nov 17, 2023
daboross
changed the title
nilaway doesn't detect guard on err variable reused in loop when assignment happens in case
nilaway doesn't detect guard on err variable when assignment to variable happens in branch, within loop
Nov 17, 2023
I think this is a pretty minimal example:
nilaway reports this as a possible nil panic:
If I replace the loop with two successive calls, it's fine with it:
Equally so if I remove the conditional within the loop:
Note, replacing the
switch
with anif
/else
also reproduces the error, as does anif
with noelse
.The text was updated successfully, but these errors were encountered: