/rules_go_dep

Converts Gopkg.lock to bazel go_repository workspace rules

Primary LanguageGoApache License 2.0Apache-2.0

Go dep rules for Bazel

dep2bazel

dep2bazel is a utility that onverts Gopkg.lock to bazel go_repository workspace rules.

After modifying Gopkg.lock with dep ensure, do:

go get -u github.com/scele/rules_go_dep/dep2bazel
dep2bazel ./Gopkg.lock > Gopkg.bzl

Refer to the generated Gopkg.bzl from WORKSPACE file like this:

load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains(go_version="1.9")

load("//:Gopkg.bzl", "go_deps")
go_deps()

The tool attempts use http_archive-based dependencies with sha256 checksums. If that fails, it will fall back to git_repository-based dependency.