go: runtime: misleading error when reflect type names clash

Please answer these questions before submitting your issue. Thanks!

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

go version devel +456a01a Wed Sep 28 16:20:41 2016 +0000 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mvdan/go"
GORACE=""
GOROOT="/home/mvdan/tip"
GOTOOLDIR="/home/mvdan/tip/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build526272435=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Run https://github.com/mvdan/reflect-names (play.golang.org does not do since I need multiple packages to trigger this).

What did you expect to see?

An error message that made me understand what was wrong.

What did you see instead?

panic: interface conversion: interface is foo.Bar, not foo.Bar

The first solution that comes to mind is that if the two names clash, the full import path should be included. For example:

panic: interface conversion: interface is github.com/mvdan/reflect-names/p1/foo.Bar, not github.com/mvdan/reflect-names/p2/foo.Bar

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

The Go compiler/runtime team discussed this and decided that we should change

interface is foo.Bar, not foo.Baz

to instead say

interface is foo.Bar (x/y/z), not foo.Baz (a/b/c)

I.e., if the package names are the same (even if the type name is different), then we include the package path afterwards.

Also that this isn’t a blocking issue for 1.10.