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

cmd/compile: interface error should show all missing methods instead of just one #17282

Closed
zwass opened this issue Sep 29, 2016 · 4 comments
Closed

Comments

@zwass
Copy link

zwass commented Sep 29, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.1 darwin/amd64

But should apply to all.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/zwass/dev/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.1/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4k/2q3ctn7d5_xb03_zsb3v6lgr0000gn/T/go-build228408602=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

But should apply to all.

What did you do?

https://play.golang.org/p/Op7-5uXv2G

What did you expect to see?

tmp/sandbox622717221/main.go:13: cannot use test literal (type test) as type foo in assignment:
    test does not implement foo (missing foo, bar, baz methods)

Error indicating each of the missing methods. The existing error message makes it seem as though adding the bar method is sufficient to fix the error. The format doesn't necessarily matter, but the error message should indicate all of the missing methods.

What did you see instead?

tmp/sandbox622717221/main.go:13: cannot use test literal (type test) as type foo in assignment:
    test does not implement foo (missing bar method)

Error indicating a single missing method (no indication of why bar happens to be the method highlighted).

@dlsniper
Copy link
Contributor

According to this: https://groups.google.com/forum/#!searchin/golang-nuts/Show$20all$20compiling$20errors%7Csort:relevance/golang-nuts/2Am5aqmIGxs/cP4PGn7c8XQJ

go build -gcflags="-e" should display all compiler errors but it still won't do it for this specific case. I think the behaviour there should be changed?

@yaxinlx
Copy link

yaxinlx commented Oct 1, 2016

The current MissingMethod function really only returns one missing method: https://golang.org/src/go/types/lookup.go?s=1550:1668#L227

@griesemer
Copy link
Contributor

griesemer commented Oct 1, 2016

@yaxinlx Just FYI, go/types is not used by the compiler, so that's not the reason why there's only one missing method shown (but go/types has the same "problem").

This is not so much an error but perhaps a "would like to have".

@griesemer griesemer added this to the Unplanned milestone Oct 1, 2016
@odeke-em odeke-em changed the title Interface errors only show single missing method cmd/compile: interface error should show all missing methods instead of just one Oct 1, 2016
@odeke-em
Copy link
Member

odeke-em commented Oct 3, 2016

Duplicate of #8095.

Closing this issue in favor of the older #8095 issue unless someone else thinks otherwise.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants