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/go: reject packages whose import paths collide with std packages #53825

Closed
hyangah opened this issue Jul 13, 2022 · 3 comments
Closed

cmd/go: reject packages whose import paths collide with std packages #53825

hyangah opened this issue Jul 13, 2022 · 3 comments
Labels
FrozenDueToAge GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jul 13, 2022

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

$ go1.19rc1 version
go version go1.19rc1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

--- go.mod ---
module sync

go1.18

--- sync.go ---
// this is my sync!
package main

What did you expect to see?

build error
(no main function!)

What did you see instead?

no error

$ go1.19rc1 build .
$ echo $?
0

$ go1.19rc1 doc .
this is my sync!

$ go1.19rc1 list -f '{{.ImportPath}} {{.Dir}}' .
sync /Users/hakim/sdk/go1.19rc1/src/sync

And go list is confused, as a result, tools that depend on x/tools/go/packages (e.g. gopls) are very confused.

@dominikh
Copy link
Member

It's worth clarifying that the go build . command in the example builds the stdlib sync package, not our package, driven by go list's confusion.

@seankhliao
Copy link
Member

I think this is either #35270 or #26227

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2022
@mknyszek mknyszek added this to the Backlog milestone Jul 13, 2022
@mknyszek
Copy link
Contributor

Yeah, I think this probably needs to be closed as a duplicate, but maybe it's got a higher priority now that it has a higher likelihood of leaking into various tools (just because there are more of them, and they're more widely used than back in #26227)?

Closing for now, will post an update to #26227. #35270 seems like it might be more modules related, somehow? I'm not sure.

@mknyszek mknyszek closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2022
@dmitshur dmitshur added the GoCommand cmd/go label Jul 13, 2022
@golang golang locked and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go 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

6 participants