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
{{ message }}
Repository navigation
Detecting Nil-Initiated Fields in Constructors #301
When running nilaway on the following code, I noticed that fields initialized as nil in the constructor are not being detected. The output is as follows:
error: Potential nil panic detected. Observed nil flow from source to dereference point:
- nilaway-sample/main.go:40:9: literal `nil` returned from `Get()`in position 0 - nilaway-sample/main.go:16:2: returned as result 0 from interface method `MyInterface.Get()` (implemented by `MyStruct2.Get()`) - nilaway-sample/main.go:12:14: result 0 of `Get()` called `String()`
Question
In the case of MyStruct1, where a field is initialized as nil in the constructor, it seems that nilaway does not detect it. Is there a way to make nilaway detect fields initialized as nil in constructors?
Activity