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.