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

vendor spec: package visibility #14031

Closed
dsnet opened this issue Jan 20, 2016 · 8 comments
Closed

vendor spec: package visibility #14031

dsnet opened this issue Jan 20, 2016 · 8 comments
Milestone

Comments

@dsnet
Copy link
Member

dsnet commented Jan 20, 2016

Copying from golang-dev

The vendor specification doesn't seem to speak much about the visibility of the vendored packages. Thus, should vendor be treated in similar ways to internal?

As it currently is, the following program compiles under go1.6beta2 (with the vendor experiment on):

package main

import "vendor/golang.org/x/net/http2/hpack"

func main() {
    hpack.NewEncoder(nil)
}

Is this expected behavior? It seems kind of odd that I can import hpack as part of the "standard" library.

This is related to #13961 and #13929.

@mdempsky
Copy link
Contributor

https://golang.org/s/go15vendor says "The short form must always be used: no import path can contain “/vendor/” explicitly." That seems to clearly disallow importing "vendor/golang.org/x/net/http2/hpack" to me.

@dsnet
Copy link
Member Author

dsnet commented Jan 21, 2016

Do you think that maybe this should be thought about for Go1.6? Personally, this issue doesn't affect me, but if we release Go1.6 with GO15VENDOREXPERIMENT enabled by default, then it will probably be harder to change specification related things in Go1.7 when the impact becomes wider.

@dsnet
Copy link
Member Author

dsnet commented Jan 21, 2016

@mdempsky, you're right. I think that does make it pretty clear that vendor should not be visible then.

@cespare
Copy link
Contributor

cespare commented Jan 21, 2016

This really seems like a bug that should be fixed for 1.6.

Note that it happens with non-stdlib vendored packages as well, so moving vendor to internal in the stdlib for 1.6 doesn't hide the issue completely.

@bradfitz bradfitz modified the milestones: Go1.6, Go1.7 Jan 21, 2016
@bradfitz
Copy link
Contributor

Over to @rsc...

@cespare
Copy link
Contributor

cespare commented Jan 21, 2016

I think this only happens when you use go run (or go build x.go), and not when building a real package.

@ThisGuyCodes
Copy link

I can confirm @cespare on this, I can build or run the file directly, but I can't build it like a package:
image
(this is on OSX, with 1.6beta2)

@rsc
Copy link
Contributor

rsc commented Jan 24, 2016

Thanks for the report.
Duplicate of #12217, fixed by https://golang.org/cl/18645 shortly after Go 1.6 beta 2 was issued.

@rsc rsc closed this as completed Jan 24, 2016
@golang golang locked and limited conversation to collaborators Jan 23, 2017
@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.
Projects
None yet
Development

No branches or pull requests

7 participants