Reputation: 1198
I need to use "vendoring" for tools used during our build (github.com/mjibson/esc
, and golang.org/x/tools/cmd/stringer
) to fulfill our source management requirements.
Our regulations require that all source code and all tools used during a build are fetched from a company-managed repository. In this case, the tools are built from source code at the beginning of the process.
Using git submodule
to fetch the sources from GitHub.com/golang.org doesn't work, because our build environment prevents any access to external repositories.
I thought of something like vendoring, i.e. have a certain version of esc
and stringer
checked in to my repository, and some reference files that keep the relation between the version I'm using and the origin repository.
For open source used during the build (referenced through import
statements), the dep
tool does a wonderful job. But it fails when I try to vendor any of the tools.
How can I manage the usage of such external tools for Go?
Upvotes: 2
Views: 610
Reputation: 1198
I actually didn't read the Package graph rules section in the Gopkg.toml documentation thorough enough:
The required
list is the place to add additional dependencies that are not referenced by import
directives in the code.
After adding my two packages and running dep ensure
, all required source code was available in the vendor
subdirectory.
My apologies...
Upvotes: 0
Reputation: 1316
You can use insteadOf
in your git config. What this does is allows you to specify a more standard import path but the actual URL that the repo is fetched from can be your private repo.
Refer to this thread: Go dep with private repo
Upvotes: 1