Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: document how to disable a vendor folder (particularly important for Go1.7+) #16562
Having vendored a package in the
Note my company's use case:
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.
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".
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.
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.
It mainly just does a