Changes
- nogo is a new framework for running static analysis as part of Bazel builds. Developers can write their own analyzers which run alongside the compiler on each Go package. Analyzers may stop the build when they detect problems.
- nogo can run
go vet
as a separate subprocess. We intend to migrate vet to the analysis framework in the future. - nogo is experimental, and its interface may change over the next few releases. Please try it out and give us feedback though.
- Thanks to Samuel Tan (@stjj89) for implementing nogo for Bazel, and thanks to Alan Donovan (@alandonovan) for creating the analysis framework nogo is based on, golang.org/x/tools/go/analysis.
- nogo can run
- rules_go now uses the new
cc_common
module to collect C / C++ flags. This ensures compatibility with future versions of Bazel, since the CROSSTOOL-related fields inCcToolchainInfo
are being removed soon. - Because of the above change the minimum supported version of Bazel is now 0.17.2.
go_download_sdk
now supportsgoos
andgoarch
attributes. These may be useful for remote execution when your execution platform is different from your host platform.- The other SDK rules will automatically detect the platform of the SDK instead of detecting the host platform.
- Cgo now declares internal targets in each supported mode that influences the selection of source files and dependencies with build constraints.
- This means binaries that set
goos
,goarch
,race
, ormsan
attributes and incorporate cgo code are more likely to be correct. Please continue to use--platforms
and other command-line flags for configuration instead though, if possible. - Unfortunately, analysis is about 15% slower because of the extra targets. We hope to improve this by integrating cgo compilation into the
go_library
rule itself, but this will take time.
- This means binaries that set
- Arm64 is now supported automatically (thanks to @ArielleA).
Updated dependencies
org_golang_x_tools
(golang.org/x/tools
) has been updated tomaster
as of 2018-09-18.org_golang_x_net
(golang.org/x/net
) has been updated tomaster
as of 2018-09-28.org_golang_x_sys
(golang.org/x/sys
) has been updated tomaster
as of 2018-09-28.com_github_golang_protobuf
(github.com/golang/protobuf
) has been updated tov1.2.0
.org_golang_google_grpc
(google.golang.org/grpc
) has been updated tov1.15.0
.org_golang_google_genproto
(google.golang.org/genproto
with pre-generated files) has been updated to master as of 2018-09-28.go_googleapis
(github.com/googleapis/googleapis
a.k.a.google.golang.org/genproto
with build-time-generated files) has been updated to master as of 2018-09-28.- See Overriding dependencies if you need a different version of any of these.
WORKSPACE code
To use this release, add this code to your WORKSPACE file:
http_archive(
name = "io_bazel_rules_go",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.0/rules_go-0.16.0.tar.gz",
sha256 = "ee5fe78fe417c685ecb77a0a725dc9f6040ae5beb44a0ba4ddb55453aad23a8a",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()