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/go2go: pkg names collision after import with rename #39853

Open
kovetskiy opened this issue Jun 25, 2020 · 1 comment
Open

cmd/go2go: pkg names collision after import with rename #39853

kovetskiy opened this issue Jun 25, 2020 · 1 comment

Comments

@kovetskiy
Copy link

@kovetskiy kovetskiy commented Jun 25, 2020

go version devel +4dfbf5ab9c7 Thu Jun 25 02:57:14 2020 +0000 linux/amd64

main.go:

package main

import (
        lib1 "bug/lib1"
        lib2 "bug/lib2"
)

func main() {
        impl1 := lib1.Bug(int){X: 1}
        impl2 := lib2.Bug(int){X: 1}
        _ = impl1
        _ = impl2
}

lib1/a.go and lib2.go are identical:

package lib

type Bug(type T) struct {
        X T
}
$ go tool go2go build
a.go2:5: lib redeclared as imported package name
        previous declaration at a.go2:5
a.go2:4: instantiate୦lib୦Bug୦int redeclared in this block
        previous declaration at a.go2:13
/usr/lib/go/bin/go [build] failed: exit status 2
@cagedmantis cagedmantis changed the title [generics] pkg names collision after import with rename cmd/go2go: pkg names collision after import with rename Jun 25, 2020
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jun 25, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 25, 2020

Thanks. This is a bug in the translation tool that lets people experiment with generics. I'll leave this issue open, but I don't expect to fix this. While experimenting with generics, don't rename your imports. If someone else wants to fix it, that would be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.