-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: document how to disable a vendor folder (particularly important for Go1.7+) #16562
Comments
We are in need of a similar solution. We are operating under Compliance constraints and are having problems with our Auditor's "Audit Trails". "Vendoring" introduces "Import" by path length and thus "conditional dependancy" which we can't get them to accept at the moment. We currently relocate "Vendored" code and rewrite the import statements. At the moment this trivial. However, pressure is growing to enforce "no vendored code". |
IMHO Additionally if Finally with many packages in vendor folder and many projects with different versions of vendored dependencies it is almost impossible to ensure that GOPATH has the correct versions when vendoring is disabled. For experiments you can rename Would "no vendor directories in the source control" rule will satisfy the compiance? It is probably easier to enforce than making sure that build scripts turn off vendoring support. |
We'll discuss this again, but FYI, we are likely to decide to maintain the status quo (no ability to disable vendoring). The word "EXPERIMENT" in the environment variable was meant to convey that the existence of the environment variable was temporary. |
As @laher suggested, we should add a recommendation (in the release notes?) to rename 'vendor' directories if vendoring behavior isn't desired. |
Thanks for all the info. It's clear to me now. @kostya-sh: "the standard library in Go 1.7 has vendored dependencies in GOROOT" - this is key. So, could you please treat this as a request for documentation? I suggest here: https://golang.org/cmd/go/#hdr-Vendor_Directories
An extra sentence or 2 would suffice. Could it be as follows please, including a recommended name (to encourage consistency in 3rd party tooling)?
Thanks again. Note: renaming issue to reflect this comment. |
For reference, I've taken the advice I received here, and made a shell script to help support my workflow. https://github.com/laher/vendoff It mainly just does a |
We're happy to take clarification for the documentation, but I do not want to do anything that prescribes a particular style of usage for the vendor directory. |
In module mode, only the vendored dependencies of the main module are used for the build. So now we have an answer: to disable vendoring, set |
go version
)?go1.7rc3
go env
)?darwin amd64
Having vendored a package in the
vendor
folder, I cannot temporarily ignore that folder and use the GOPATH (VCS'ed) copy of the package, while testing/integrating changes to that repository.Note my company's use case:
golibs
).golibs
repository.GO15VENDOREXPERIMENT=0
during development / testing of changes to the shared repo. This is a pretty fundamental part of our workflow. In Go1.7, this facility is going away.Either:
go [build|install|test] -novendor
Or:
vendor
folder.vendor
directory to_novendor
. See proposal: cmd/go: do not enable GO15VENDOREXPIRIMENT by default until Go 1.7 #13218 for rsc's suggestion along these lines..gitignore
) the_novendor
folder, and a local-ignore for thevendor
folder (e.g. .git/info/exclude
orgit update-index --skip-worktree
).Or, some other solution. I can't come up with any other workable alternative. I have tried and failed to devise alternatives using symbolic links, git submodules, and partially vendoring dependencies. None of these have resulted in satisfactory outcomes. Note that I have as-yet been unable to find a 3rd party 'vendoring' tool which addresses this issue, either.
The Go1.7 release candidates do not provide any flag for switching off vendoring, nor do they document alternatives, nor provide recommendations for this use case.
Thankyou
The text was updated successfully, but these errors were encountered: