Skip to content

cmd/gc: improve "type *X has no field or method M" message when X is an interface type  #10700

@Sajmani

Description

@Sajmani

When using a new, unfamiliar package, programmers occasionally make the error of using a pointer to an interface type instead of the interface type directly:
http://play.golang.org/p/JulyJVaOrG
The compiler reports the error:
/tmp/sandbox956919287/main.go:8: x.Do undefined (type *ImportedFromSomewhere has no field or method Do)
While this is correct, it would be helpful to point out that *ImportedFromSomewhere is a pointer to an interface type, and better yet, that ImportedFromSomewhere has the desired method Do.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions