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: Canonical paths should be enforced on vendored imports #19224

Closed
apilloud opened this issue Feb 21, 2017 · 5 comments
Closed

cmd/go: Canonical paths should be enforced on vendored imports #19224

apilloud opened this issue Feb 21, 2017 · 5 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@apilloud
Copy link
Contributor

I have a package which vendors packages with Canonical Imports. Build worked fine when the imports were vendored but failed when the packages were moved into the GOPATH. This is because canonical import paths are not enforced on vendored packages.

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

From vendor support merging to latest master (a355639)

What did you do?

  1. Wrote a package which imported 'github.com/rsc/pdf'
  2. git cloned 'github.com/rsc/pdf' in the packages 'vendor' directory
  3. Ran go build .

What did you expect to see?

mypackage.go:8:2: code in directory $GOPATH/vendor/github.com/rsc/pdf expects import "rsc.io/pdf"

What did you see instead?

Nothing. (Command exited with success.)

@apilloud
Copy link
Contributor Author

Fix is here: https://go-review.googlesource.com/c/37371/

@gopherbot
Copy link

CL https://golang.org/cl/37371 mentions this issue.

@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Feb 21, 2017
@bradfitz bradfitz added this to the Go1.9 milestone Feb 21, 2017
@bradfitz
Copy link
Contributor

Leaving for @rsc. I'm not sure whether the current behavior is intentional. I guess not, though.

@rsc
Copy link
Contributor

rsc commented Jun 26, 2017

It's intentional that the code doesn't complain that rsc.io/pdf is found in foo.com/vendor/rsc.io/pdf. It was not strictly intentional that it also doesn't complain about foo.com/vendor/github.com/rsc/pdf, but maybe that's OK too. Not sure.

@rsc
Copy link
Contributor

rsc commented Dec 1, 2017

Every time I change the conditions under which this error triggers, it breaks someone. I am inclined to leave this alone. It's OK that we're not enforcing the import paths in the vendor dir: let's assume that's managed by a tool that knows what it's doing. In the long term we hope vendor dirs disappear.

@rsc rsc closed this as completed Dec 1, 2017
@golang golang locked and limited conversation to collaborators Dec 1, 2018
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants