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
Closed

cmd/compile: ambiguous interface conversion panic message #21156

rogpeppe opened this issue Jul 25, 2017 · 2 comments

Comments

@rogpeppe
Copy link
Contributor

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
Copy link
Member

mvdan 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 as completed Jul 25, 2017
@rogpeppe
Copy link
Contributor Author

@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.
Projects
None yet
Development

No branches or pull requests

3 participants