Intro: dep is a tool to manage dependencies of Go projects. bazel is a build tool that produces stable, reproducable builds. There is a bazel rule set for Go projects, including an automatic build-file generator, gazelle, that generates Bazel build files following the conventions that go build
would apply, using the dependencies declared in the bazel WORKSPACE
.
The WORKSPACE
, though, I have to create by hand or by help of a little hackish helper tool, wtool
. dep
, on the other hand, helps track dependencies, is able to download them into a vendor/
directory and locking specific versions.
To me it appears that the Gopkg.lock
file that dep uses to specify versions of dependencies (usually by their VCS commit hash) would be easily translated into a bazel WORKSPACE
file. I have successfully done so manually in a company-internal project as well.
Is there an existing link between bazel and its Go rules and dep that I could have used instead of doing this manually?
(Additionally: Is anybody else doing this? Should I be doing this at all?)