Skip to content

cmd/compile: confusing type assertion failure error message #49005

@rsc

Description

@rsc
% cat /tmp/x.go
package p

type T interface{ M() }

func F() T

var _ = F().(*X)
% go tool compile /tmp/x.go
/tmp/x.go:7:9: impossible type assertion: F() (value of type T) (missing method M)
/tmp/x.go:7:15: undefined: X

The problem in this program is that X is not defined.
The first error is very confusing and is noise.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions