Unlike the make
-driven build process which uses the checked-in sources in the vendor
submodule, the Bazel build will download sources as needed. Under normal circumstances this should be transparent to the user, but if you are in an environment with no network access you’ll have to do some planning ahead of time to make sure you have all the dependencies needed to build. There are two general approaches here: an ad-hoc method and building a distdir.
A note about Non-Bazel tools
Bazel fetches dependencies from a bunch of tarballs/zip files over https, and it stores them in a directory called the “repository cache” (bazel info repository_cache
). This is different from how the standard go
toolchain handles dependencies; in particular, it has a different module cache that is not compatible with Bazel’s. Use go mod download
to pre-fetch Go dependencies for use by non-Bazel tools, like your IDE or code editor.
Ad-hoc bootstrapping for offline builds
...