-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for errors.As
in trusted functions framework
#95
Comments
@sonalmahajan15 Is there a timeline for fixing this false positive? |
@gaby, I am working on a few higher priority items at the moment, after which I plan to come to this issue. The implementation of this feature is not as straightforward either. So, unfortunately it might take a little more time than expected. |
The weird thing here is that package main
import (
"errors"
"fmt"
"github.com/go-sql-driver/mysql"
)
func main() {
var x *mysql.MySQLError
var err error = x
var merr *mysql.MySQLError
fmt.Println(err == nil)
fmt.Println(errors.As(err, &merr))
fmt.Println(merr == nil)
} The doc states that
In this case, the first error is a typed However, in practice we probably will never encounter such as case, since if we really want to say “there’s no error”, we return an untyped Go is a bit weird when it comes to interfaces and typed nil vs untyped nil. But for this particular case I think NilAway can assume the result would be nonnil (just like what the official doc did). |
I have a bit of code w/ custom errors and errors.As sprinkled throughout to get additional info, it would be nice to have a flag to ignore error.As. As @yuxincs pointed out it technically is possible but very unlikely in real settings. |
error.As
reports a false positive as shown below. Add support for errors.As, and other similar functions in the trusted functions framework.The text was updated successfully, but these errors were encountered: