Changes
- The Go extension can now generate targets with a new naming convention.
- In new projects, by default, a library will be named
foo
if its import path ends withfoo
instead ofgo_default_library
. Similarly, a test will be namedfoo_test
instead ofgo_default_test
. - Gazelle will attempt to detect the naming convention used in existing projects, so it shouldn't unexpectedly change the naming convention.
- To specify the naming convention explicitly, use the
# gazelle:go_naming_convention
directive or the-go_naming_convention
flag. Valid values areimport
,go_default_library
, andimport_alias
. Gazelle will rename existing targets the next time it runs after a change. go_repository
uses theimport_alias
naming convention by default, so either the old or new names may be used.- Thanks to @tomlu for implementing this.
- In new projects, by default, a library will be named
- Added
# gazelle:go_generate_proto
directive, which instructs the Go extension whether to generatego_proto_library
rules forproto_library
generated by the proto extension (thanks @linzhp). - Improved Windows compatibility (thanks @tomlu).
- Language extensions can now provide dependency resolution for other extensions by implementing the
resolve.CrossResolver
interface. This is now used for resolve proto imports in Go (thanks @blico). - In the
update-repos
command, the-build_directives
flag may be used to set thebuild_directives
attribute on generated repositories (thanks @Helcaraxan). - In the
update-repos
command, new rules and macros will be inserted higher inWORKSPACE
, abovego_rules_dependencies
andgazelle_dependencies
if possible, to make it easier to override indirect dependencies.
Compatibility
gazelle_binary
no longer supports mode attributes such asgoos
,race
, andgotags
. These depended on internal implementation details in rules_go. If you need to build agazelle_binary
for a platform other than the host, use command-line flags such as--platforms
and--@io_bazel_rules_go//go/config:race
or use a transition.
WORKSPACE code
http_archive(
name = "bazel_gazelle",
sha256 = "d4113967ab451dd4d2d767c3ca5f927fec4b30f3b2c6f8135a2033b9c05a5687",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()