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: ambiguous interface conversion panic message #21156

Closed
rogpeppe opened this issue Jul 25, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@rogpeppe
Copy link
Contributor

commented Jul 25, 2017

go version devel +286599f Tue Jul 11 18:32:56 2017 +0000 linux/amd64

When a dynamic type coercion between two types with the same
package identifier and type name, the panic message is confusing
because it does not include the package path.

For example, when running:

package main

import (
	cookiejar2 "github.com/juju/persistent-cookiejar"
	"net/http"
	cookiejar1 "net/http/cookiejar"
)

func main() {
	jar, _ := cookiejar1.New(nil)
	j := http.CookieJar(jar)
	_ = j.(*cookiejar2.Jar)
}

I see:

panic: interface conversion: http.CookieJar is *cookiejar.Jar, not *cookiejar.Jar

goroutine 1 [running]:
main.main()
	/home/rog/src/tst.go:12 +0xff

I would expect to see something like this instead:

panic: interface conversion: http.CookieJar is *"net/http/cookiejar".Jar, not *"github.com/juju/persistent-cookiejar".Jar
@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 25, 2017

Duplicate of #17283, I'm afraid.

@mvdan mvdan marked this as a duplicate of #17283 Jul 25, 2017

@mvdan mvdan closed this Jul 25, 2017

@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2017

@mvdan Ah, thanks. I searched for "interface conversion" but didn't find that issue.

@mikioh mikioh changed the title ambiguous interface conversion panic message cmd/compile: ambiguous interface conversion panic message Aug 2, 2017

@golang golang locked and limited conversation to collaborators Aug 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.