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
proposal: cmd/go: detect use of code outside current directory tree #22440
Comments
Can't that new option simply be:
|
"GOPATH= |
The point is, set Or maybe I don't understand what you are asking for. Can you show a tiny complete example? |
For example, this is a file under my project root:
And here is another package "b" in the vendor folder which is directly under the project root folder.
Then
A bare "go build" will succeed, even if the package "b" is not vendored, but it is under GOPATH/src. |
It would be also ok if go tools support a "GOPATHSRC" env variable, so that I can use "GOPATHSRC= |
Damn it. It looks the "GOPATHSRC" env variable has really been supported. |
But it doesn't solve my problem. If package "b" is under GOPATH/src but not vendored, "GOPATHSRC=pwd go build" still will succeed. |
my mistake, "GOPATHSRC=pwd" is a nonsense in my experiments. "GOPATHSRC" env variable is not supported yet. |
Leaving on hold for package management. |
Closed for the Go modules feature is mature now. |
The Problem
For many times, my project dependency packages are not placed in the vendor folder of my project.
But these dependencies are under other paths which are under GOPATH/src.
So "go build" an "go install" both succeed on my local machine development env.
But when the two commands both fail on machines of my teamworkers and server env, for some dependency packages are not vendered.
The Proposal
So I proposal an option for these commands, to exclude all custom packages except the ones under pwd in building, so that I can find the missed vendor packages as early as possible. Currently, I must build my project in a docker container to achieve the goal. It is not very convenient.
The text was updated successfully, but these errors were encountered: