Changes
- rules_go now supports the new API for protocol buffers.
- To summarize the announcement, there's a new protobuf module,
google.golang.org/protobuf
(APIv2). The old module,github.com/golang/protobuf
(APIv1) has been re-implemented in terms of the new module. Using either API is fine. - rules_go will continue to use
protoc-gen-go
from APIv1 for now, since the APIv2 does not support gRPC, and there is no gRPC generator yet. See the note on gRPC support in the v1.20.0 release notes. - Code generated with either module should work with both APIs. However, code generated with older versions of APIv1 will not not work with the latest version of either module.
- To summarize the announcement, there's a new protobuf module,
- rules_go has migrated to Starlark build settings and configuration transitions.
- Instead of using feature flags like
--features=race
, you can now use flags like--@io_bazel_rules_go//go/config:race
. go_binary
andgo_test
mode attributes such asrace
,pure
,goos
, andgoarch
have been reimplemented using transitions. Conditional dependencies chosen withselect
should now work correctly.go_binary
andgo_test
now support agotags
attribute, which lets a binary and its dependencies be built with a list of build constraints. This can also be set on the command line with--@io_bazel_rules_go//go/config:tags
.- Output file paths no longer include extra configuration data. For example,
//tests/core/go_binary:hello
creates the filebazel-bin/tests/core/go_binary/hello_/hello
. Note that output file paths are still not stable and should not be depended on unless the"out"
attribute is set explicitly (for rules that support it).
- Instead of using feature flags like
Compatibility
- The minimum supported version of Bazel is now 2.2.0. This version bump was needed to take advantage of support for build settings and configuration transitions.
- Go versions older than 1.13 are no longer supported.
- The deprecated
searchpaths
andsearchpath
fields have been removed fromGoArchive
andGoArchiveData
.
Updated dependencies
platforms
is updated tomaster
as of 2020-05-12.rules_cc
is updated tomaster
as of 2020-05-12.org_golang_x_tools
is updated tomaster
as of 2020-05-12.org_golang_x_xerrors
(golang.org/x/xerrors) is added atmaster
as of 2020-05-12. It's needed byorg_golang_x_tools
.org_golang_google_protobuf
(google.golang.org/protobuf) is added atv1.22.0
, latest as of 2020-05-12.com_github_golang_protobuf
is updated tov1.4.1
, latest as of 2020-05-12.org_golang_google_genproto
is updated tomaster
as of 2020-05-12.go_googleapis
is updated tomaster
as of 2020-05-12.
WORKSPACE code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "6a68e269802911fa419abb940c850734086869d7fe9bc8e12aaf60a09641c818",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.23.0/rules_go-v0.23.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.23.0/rules_go-v0.23.0.tar.gz",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()