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: compilation fails if mutiple packages with the same name are imported #40318

Closed
DeedleFake opened this issue Jul 20, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@DeedleFake
Copy link

Playground

package main

import (
	crand "crypto/rand"
	"math/rand"
)

func main() {
	_ = crand.Reader
	_ = rand.Source(nil)
}

Output:

./prog.go2:4: rand redeclared as imported package name
	previous declaration at ./prog.go2:4
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 21, 2020
@toothrot toothrot added this to the Unreleased milestone Jul 21, 2020
@gopherbot
Copy link

Change https://golang.org/cl/244621 mentions this issue: [dev.go2go] go/go2go: don't import renamed package twice

@ianlancetaylor
Copy link
Contributor

Thanks. Fixed on go2go branch.

I'm sure there are cases using local import aliases that will fail with the translation tool. But we can fix this one, at least.

gopherbot pushed a commit that referenced this issue Jul 23, 2020
We keep an import spec if it uses a local alias. Avoid importing it
again, unless it is required by something else.

Fixes #40318

Change-Id: If90de3bf30412645c9144083372e6b07df3c6a0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/244621
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants