-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Milestone
Description
What version of Go are you using (go version)?
$ go version go1.15.6
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
n/a
What did you do?
This code:
type FooError interface {
Something() int
Error() string
}
err := someCall();
err.(*FooError)
Complains:
impossible type assertion:
*FooError does not implement error (missing Error method)
The issue is that you need to write err.(FooError).
What did you expect to see?
It'd be much more helpful if it'd call out that FooError does implement error, so the problem is the added pointer indirection.
This mistake is likely because usually the concrete struct types implement error via the pointer reference, so if you change code from the concrete struct error to an interface type, you're likely to miss a * in there.
What did you see instead?
The error message above.
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Type
Projects
Status
Triage Backlog