Compatibility
The minimum supported version of Bazel is now 0.23.0.
Ubuntu 14.04 is no longer supported.
Changes
- When cross-compiling, a C/C++ toolchain is no longer required. Previously, a toolchain was required but usually not used. To cross-compile with cgo, add a
_cgo
suffix to the target platform. For example,--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64_cgo
. - When stamping
go_binary
andgo_tests
with thex_defs
attribute, the--stamp
command-line flag must be used. Without this flag, link stamping is not done. This improves caching of link actions and is consistent with whatcc_binary
and other native Bazel rules do. - A repository named
go_sdk
is no longer required.go_register_toolchains
will automatically detect any declared SDK workspaces. This simplifies workspaces that use both local and remote execution. linkmode = "pie"
is now supported ingo_binary
andgo_test
.go_library
now supports animportpath_aliases
attribute that accepts a list of alternative strings that may be used to import the package. This is needed for minimal module compatibility.- Go packages are now built with a single
GoCompilePkg
action. We no longer use separate actions for compilation, coverage, assembly, packing, etc. cgo code is no longer built withcc_library
and custom rules. This should reduce overhead in remote execution configurations.
Deprecations
- The
objc = True
feature is now deprecated.go_library
and other rules can now compile .m and .mm files directly whencgo = True
is set. - Go 1.10 support is now deprecated.
See Deprecation schedule for more information.
Updated dependencies
bazel_skylib
has been updated to 0.8.0.org_golang_x_tools
has been updated tomaster
as of 2019-07-08.com_github_golang_protobuf
has been updated to v1.3.1.com_github_mwitkow_go_proto_validators
has been updated tomaster
as of 2019-07-08.go_googleapis
has been updated tomaster
as of 2019-07-09.
Several workspaces are no longer declared in go_rules_dependencies
.
com_google_protobuf
is no longer declared. Users ofproto_library
andgo_proto_library
must declared it separately in WORKSPACE. Its dependencies must also be declared using its dependency macro,protobuf_deps
, declared in@com_google_protobuf//:protobuf_deps.bzl
. See Proto dependencies for more information.org_golang_google_grpc
is no longer declared. Recent versions have a large number of dependencies, and we can't realistically manage all of them. It's better to import them asgo_repository
rules usinggazelle update-repos
. See gRPC dependencies for more information.org_golang_x_net
,org_golang_x_text
, andorg_golang_x_sys
are no longer declared. They were provided as dependencies of gRPC.com_github_golang_glog
is no longer declared. It was only used in a legacy example.com_github_kevinburke_go_bindata
is now declared in thego_embed_data_dependencies
macro in@io_bazel_rules_go//extras:embed_data_deps.bzl
. It has been updated to v3.13.0, the latest version as of 2019-07-08.
WORKSPACE code
To use this release, add the code below to your WORKSPACE file.
REMINDER: com_google_protobuf
and some other proto repositories are no longer declared in go_rules_dependencies
. See Proto dependencies and gRPC dependencies for details.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
],
sha256 = "9fb16af4d4836c8222142e54c9efa0bb5fc562ffc893ce2abeac3e25daead144",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()