Releases: bazel-contrib/rules_go
Releases · bazel-contrib/rules_go
0.5.4
This release is a bug fix release before upcoming major changes.
- Compatibility fixes for upcoming skylark alterations.
- go_library rules now propagate transitive depsets of the GoLibrary provider rather than individual fields
- Better support for coverage, now works on more than just the package under test
- Experimental support for a GOPATH-like source export system to run tools on
- Experimental support for generating "flat" build files in gazelle
- Minor bug fixes
0.5.3
Go Rules
go_library
supports cgo when thecgo = True
argument is given.cgo_library
is no longer needed and is now deprecated.- Race detection is supported. You can use it in tests with
bazel test --features=race //...
. go_embed_data
(a new rule) lets you embed data files in generated Go code.go_test
accepts arundir
attribute that lets you specify where the test should run. Test binaries will no longer attempt to change directories when run outside of Bazel.- Lots of bug fixes and refactoring.
Gazelle
- Gazelle now accepts the
update
andfix
commands.update
is the normal, default behavior.fix
will revise existing build files with deprecated rules likecgo_library
. We plan to add more commands with different flags in the future. - Rewrote the Gazelle documentation.
- Lots of bug fixes and refactoring.
0.5.2
This is a quick fix release.
- Fixed usage of declared providers and avoided mixing declared and old-style providers.
go_binary
now produces static binaries through thestatic
output group.- Bazel 0.5.2 is now the required minimum version.
0.5.1
Go rules
- Dependency checking is now strict:
go_library
,go_binary
, andgo_test
must now include a library indeps
for each package they import. Previously, transitive deps were allowed. This lets us speed up the build by only passing direct deps to the compiler. cgo_genrule
is deprecated. It now just invokescgo_library
withtags = ["manual"]
. Please usecgo_library
directly when possible.- Several internal improvements were made to
cgo_library
. We are planning to consolidate it withgo_library
some time in the future. deps
are now propagated through thelibrary
attribute. This means, for example, ago_test
rule doesn't need to repeat deps specified in ago_library
under test, though doing so is encouraged if thego_test
references those dependencies itself.go_test
will now always change to the package directory before running test cases. This was previously broken for tests in external repositories.
Gazelle
- Generated .go files will now be included in rules that Gazelle creates. Gazelle discovers these files by looking at filenames in
out
andouts
attributes of other rules in BUILD files. - Gazelle only generate BUILD files in
testdata
directories if there are no .go files, BUILD files, or BUILD.bazel files in any subdirectory. Previously, Gazelle did not recurse intotestdata
directories at all. - Go release tags (e.g.,
go1.8
) are treated as unknown (neither true nor false). Gazelle will include files with these tags, whether or not they are negated. This avoids some confusing situations where Gazelle is compiled with a different version of Go than the one used to build a project. - Several improvements for merging with existing files.
copts
andclinkopts
attributes are now merged.visibility
won't be added if apackage
rule with adefault_visibility
attribute is present. Comments are preserved on existing elements.deps
are now sorted according to buildifier rules.
0.5.0
Features
go_repository
replacesnew_go_repository
for dependencies with
and without BUILD or BUILD.bazel files.go_repository
will
generate these files using Gazelle if they are not already present.- Import paths may be specified explicitly using the
importpath
in
go_library
. This allows for Go subtrees that aren't at the top of
a repository. It also allows flat BUILD files. - Gazelle generates BUILD files for multiple platforms. Sources with
build constraints (tags or filename suffixes) and dependencies
imported from them are now compiled conditionally usingselect
. - Link stamping in multiple packages is now supported via the
x_defs
attribute.x_defs
may now contain values wrapped in braces (for
example:{VAR}
) which are replaced with values from the workspace
status files. - Rules are substantially cleaned up and organized. Assemble, compile,
and link actions are rewritten in Go, avoiding incompatibilities and
quoting problems with Bash. - Preliminary support for toolchains.
Bug fixes
cgo_library
now allows sources in multiple directories.cgo_library
no longer assumessrcs
is a list (it can now include
select
calls).go_binary
andgo_test
no longer expose .a files in outputs.- All rules now allow target names with slashes.
- If multiple packages are present after applying build constraints,
Gazelle will generate BUILD files for the package matching the
directory name. If there is no match, Gazelle will report an error. - Gazelle is much faster when running in external mode on repositories
with lots of external dependencies. - Gazelle no longer removes
# keep
comments from existing sources. - Many more...
0.4.4
0.4.3
Features
- Upgraded to Go 1.8.1 and provided backward compatibility for tests in 1.7.5.
- Support for build constraints (build tags and filename suffixes) in
go_library
,cgo_library
,go_test
, andgo_binary
. You can now add all your sources to your rules, and they will be filtered during compilation.- Note: Gazelle also filters sources with build constraints. This behavior will be removed when #339 is fixed.
go_repositories
now supports custom Go versions. Versions can be specified with a simple version string (e.g., "1.8.0") or by declaring a separate Bazel repository and providing that through thego_linux
orgo_darwin
attributes.go_repository
now supportsvcs
andimportpath
attributes. This enables repositories with different URLs and import paths.gc_goopts
andgc_linkopts
attributes can be used to pass additional options to the compiler and linker.protoc
andprotoc_gen_go
can now be overridden ingo_proto_library
. Also added anignore_go_package
attribute.- Gazelle now adds a
data
dependency ontestdata
directories.
Bug fixes
- Fixed repositories rules that depended on the real names of repositories. This broke when one of our dependencies (github.com/bazelbuild/buildifier) was renamed to buildtools. A quick fix was backported to 0.4.2 and 0.3.4.
- Fixed
-mode diff
in Gazelle. It now produces a regular textual diff. - Gazelle no longer attempts to rename files with
-mode fix
or-mode print
. - Gazelle can now find
# gazelle:ignore
comments that aren't at the top of a file. - Bash scripts generated by rules are now executed as commands instead of executable files. This is required on Windows.
- Fixed an infinite recursion issue on Windows.
data
files are now propagated transitively across dependencies.
0.4.2
This release fixes a break which was caused by github.com/bazelbuild/buildifier being renamed to buildtools. The following changes are cherry-picked:
0.3.4
This release fixes a break which was caused by github.com/bazelbuild/buildifier being renamed to buildtools. The following changes are cherry-picked: