Open lbjarre opened 10 months ago
Confirming the issue is related to analysis of the value of the AnError
expression in func action
.
The following variation of program doesn't raise the error:
package main
import "errors"
var AnError = errors.New("this is an error")
func action(x bool) (*bool, error) {
if x {
return nil, AnError
}
var b bool
return &b, nil
}
func useAction() error {
ptr, err := action(true)
if err != nil {
return err
}
_ = *ptr
return nil
}
@lbjarre: ACK. Thanks for reporting the issue. This is an interesting case. We do support error
type for variables, return values, etc. (as confirmed by @dolmen), but not for named types. We will extend our support for handling such cases.
@sonalmahajan15 I am interested in this. Can I take this up?
@cheny-alf: Sure, go ahead. Let us know if you need any help :)
Hello,
First of all, thanks for open sourcing this! I'm testing it out in some codebases and it seems to be very capable of detecting lots of error already.
I have a codebase where using type wrappers on top of strings seems to trigger a false positive. Minimal reproducing program:
Results in this analysis: