Skip to content
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

proposal: cmd/go: run the errors.As vet check as part of `go test` #31213

Open
jba opened this Issue Apr 2, 2019 · 1 comment

Comments

Projects
None yet
4 participants
@jba
Copy link
Contributor

jba commented Apr 2, 2019

This new vet check validates that the second argument to errors.As is a pointer to an interface or a type implementing error.

It can generate a false positive if a valid value is held in a different static type, such as

var e error
var i interface{} = &e
... errors.As(..., i) ...

but that's unlikely.

@andybons andybons changed the title cmd/go: run the errors.As vet check as part of `go test` proposal: cmd/go: run the errors.As vet check as part of `go test` Apr 3, 2019

@gopherbot gopherbot added this to the Proposal milestone Apr 3, 2019

@gopherbot gopherbot added the Proposal label Apr 3, 2019

@andybons

This comment has been minimized.

Copy link
Member

andybons commented Apr 17, 2019

Is there a way to get more data on how often this occurs?

Also can we make this more reliable by ignoring the empty interface like in your example above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.