Releases: bazel-contrib/rules_go
0.11.1
Go support
Added support for Go 1.10.2 and 1.9.6.
Bug fixes
- #1452 - Fix build error when go_test contains TestMain but no tests
- #1462 - Refactor coverage support
- #1471 - Fix coverage bugs
- #1478 - Fix coverage issues around cgo. (n.b. coverage with cgo is not supported yet, but it's closer to working than before).
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.11.1/rules_go-0.11.1.tar.gz",
sha256 = "1868ff68d6079e31b2f09b828b58d62e57ca8e9636edff699247c9108518570b",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.10.4
Go support
Added support for Go 1.10.2 and 1.9.6.
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.10.4/rules_go-0.10.4.tar.gz",
sha256 = "6c770aece75ac47fe218ad881775c37cf29db013ab751d0bfef01c0b5a6ee01f",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.11.0
New features
- Go 1.10.1 and 1.9.5 are now supported.
go_path
has been rewritten. This rule can be used to
generate a GOPATH-like directory tree from a set of Go rules (e.g.,
go_binary
,go_library
). It will contain source and data files for those
rules and their transitive dependencies, including generated files. The
directory tree may contain copied files, symbolic links, or may be a zip
archive. This is not complete yet, but it should be usable for simple tools.go_embed_data
now supports anunpack
attribute, which allows it to unpack
zip and tar archives.go_binary
supports thec-archive
andc-shared
link modes.go_binary
now supports anout
attribute, allowing you to write binaries
with custom names.go_test
now runs examples.- Proto library rules for Well Known Types are now defined in the
@io_bazel_rules_go//proto/wkt
package.go_proto_library
rules using the
default, gRPC, and gogo plugins depend on these implicitly. These should be
used instead of explicit vendored or external versions. go_proto_library
now supports theimportmap
attribute.
Notes
- The Bazel minimum version is now 0.10.0.
- We've gotten a number of error reports in builds where multiple packages
with the same import path are linked into the same binary. This is especially
common when libraries are in both external repositories and vendor directories.- The
GoLink
action will print a warning when this condition is detected.
This will be an error in the future. - The
importmap
attribute can be used to disambiguate these cases. Newer
versions of Gazelle will setimportmap
automatically forgo_library
andgo_proto_library
rules in vendor directories. This is similar to what
the standard Go toolchain does.
- The
Updated dependencies
The following repositories declared in go_rules_dependencies()
were updated to
new versions.
bazel_gazelle
to master as of 2018-04-02.com_github_mwitkow_go_proto_validators
to master as of 2018-04-02.org_golang_x_net
to master as of 2018-04-02.org_golang_x_text
to master as of 2018-04-02.org_golang_google_genproto
to master as of 2018-04-02.
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.11.0/rules_go-0.11.0.tar.gz",
sha256 = "f70c35a8c779bb92f7521ecb5a1c6604e9c3edd431e50b6376d7497abc8ad3c1",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.10.3
Bug fixes
- #1431 - go_proto_library once again can import proto files from go_proto_libraries that were embedded in intermediate go_library dependencies.
- #1428 - compiler now writes valid empty archives instead of 0-byte files when all source files are filtered out by build constraints.
- #1425 - compiler now correctly filters files generated by cgo for tests. This allows tests with mixed internal and external sources to include cgo.
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.10.3/rules_go-0.10.3.tar.gz",
sha256 = "feba3278c13cde8d67e341a837f69a029f698d7a27ddbb2a202be7a10b22142a",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.10.2
New Go versions
rules_go now supports Go 1.10.1 and 1.9.5.
Bug fixes
- #1407 - Include import paths in coverage file names
- #1408 - Remove mapping for local_config_cc to fix problems when the generation is updated.
- #1394 - protoc: create trivial files for missing outputs
- #1388 - proto: embed doesn't have GoProtoImports provider
- #1387 - Save test coverage data to bazel-testlogs.
- #1382 - Handle Windows long file names in a few more places.
- #1355 - generate_test: implement example testing
- #1363 - Fix error check in stdlib builder
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.10.2/rules_go-0.10.2.tar.gz",
sha256 = "4b2c61795ac2eefcb28f3eb8e1cb2d8fb3c2eafa0f6712473bc5f93728f38758",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.10.1
Bug fixes
- #1342 - Don't force external linking for static builds
- #1344 - Remove previously copied files before building stdlib
- #1346 - compile: set -p to the actual import path, not the source import path
- #1348 - stdlib: dereference all symlinks before copying a directory
- #1349 - overlay repositories: resolve labels before downloading
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.10.1/rules_go-0.10.1.tar.gz",
sha256 = "4b14d8dd31c6dbaf3ff871adcd03f28c3274e42abc855cb8fb4d01233c0154dc",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
0.10.0
Go rules
- Support for Go 1.10, 1.9.3, 1.9.4, 1.8.6, and 1.8.7.
go_library
supports a new attribute,importmap
. This lets you set the "actual" import path of a library, which is what the compiler and linker will see. This is only needed when linking binaries that include multiple packages with the same import path.importpath
is still the name by which libraries are imported by source files in other libraries.go_test
may now include sources from both internal tests (compiled in the same archive as the code under test) and external tests (compiled in a separate archive).go_test
now recognizes the standardshard_count
attribute (see Attributes common to all test rules).- Removed
wtool
. Usegazelle update-repos example.com/repo
instead. - Removed old Gazelle tree. Use
github.com/bazelbuild/bazel-gazelle
instead.
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.10.0/rules_go-0.10.0.tar.gz",
sha256 = "53c8222c6eab05dd49c40184c361493705d4234e60c42c4cd13ab4898da4c6be",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
Direct download: rules_go-0.10.0.tar.gz
0.9.0
Go rules
- Support for transitive link stamping. You can now set
x_defs
attributes ingo_library
rules. Any binary rules that depend on those libraries (directly or transitively) will apply those definitions at link time. See Defines and Stamping for more information. - Refactored rules and toolchain internals. This doesn't affect normal usage of Go rules, but if you maintain Bazel rules that depend on Go providers and toolchains, see documentation in go/toolchains.rst, especially on
GoContext
andgo_context
. - The
library
attribute is now deprecated. Please migrate toembed
instead.gazelle fix
will do this for you automatically. - Several fixes for cgo, Windows, and ppc64.
- Fixed a bug in the code used to check the minimum Bazel version.
Proto rules
- Support for gogo proto. See
GOGO_VARIANTS
in proto/BUILD.bazel for available compiler plugins. See gogo/BUILD.bazel for an example. - Proto files no longer need to set
option go_package
, and the protopackage
doesn't need to match theimportpath
explicitly set ingo_proto_library
.
Gazelle
Reminder: the old Gazelle tree at go/tools/gazelle is deprecated and will be removed soon (#1199). The new location is github.com/bazelbuild/bazel-gazelle. Please update any tooling you have that builds Gazelle at master.
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.9.0/rules_go-0.9.0.tar.gz",
sha256 = "4d8d6244320dd751590f9100cf39fd7a4b75cd901e1f3ffdfd6f048328883695",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
Direct download: rules_go-0.9.0.tar.gz
0.8.1
Go rules
go_binary
now supportsgoos
andgoarch
attributes. This enables multiple target platforms in the same build.- Fixed an issue which caused the build to fail with the message: "Unsupported architecture: unknown" on newer Linux distributions. We now default to amd64 when we can't detect the architecture with
uname -p
on Linux. - Multiple fixes for builds with
--features=pure
and--features=race
.
Gazelle
# gazelle:prefix example.com/repo
can be used to set the prefix within a subtree.- Fixed some logic bugs around dependency resolution, deletion of rules, and
# gazelle:ignore
.
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.8.1/rules_go-0.8.1.tar.gz",
sha256 = "90bb270d0a92ed5c83558b2797346917c46547f6f7103e648941ecdb6b9d0e72",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
Direct download: rules_go-0.8.1.tar.gz
0.8.0
Go rules
- Minimum Bazel version is now 0.8.0.
- The
config_setting
rules in//go/platform
are now based onconstraint_values
instead ofcpu
. This means that you can writeselect
expressions that match any platform that the Go SDK targets. - Go executable files now end with ".exe" on Windows.
- Output paths have changed for nearly all rules to include the target platform and configuration. This preserves the cache when targets are built in different configurations.
- Fixed cgo tag filtering for "pure" builds.
- Support for linux/s390x as a host platform (thanks to @kadamvandita).
Proto rules
- The proto compiler is now selected using an explicit
compiler
attribute ingo_proto_library
. We no longer use toolchains for this. This lets you use different plugins for different proto libraries. go_grpc_library
is now a macro aroundgo_proto_library
with a gRPC plugin. We plan to deprecate this soon.
Gazelle changes
- Gazelle builds an index of all libraries in a repository and uses the index to resolve dependencies. This enables multiple vendor directories, Go subtrees not at the repository root, and more.
# gazelle:exclude
can be used to ignore paths in subdirectories, not just files in the current directory.- Removed the experimental flat mode. We planned to use flat files with
new_http_archive
/new_git_repository
, but this would cause unnecessary work when migrating repositories to Bazel. We're exploring other solutions.
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.8.0/rules_go-0.8.0.tar.gz",
sha256 = "8eaf2e62811169d9cf511209153effcb132826cea708b2f75d4dd5f9e57ea2aa",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
Direct download: rules_go-0.8.0.tar.gz