bazel-gazelle
bazel-gazelle copied to clipboard
feat(bzlmod: `go_deps.from_file`) to add default tags/directives
In WORKSPACE
, we can run gazelle update-repos
with the following args:
"bazel run //:gazelle -- \
"update-repos" \
"-prune" \
"--from_file=src/code.uber.internal/go.mod" \
"-build_file_proto_mode=disable" \
"-build_file_generation=on" \
"-build_extra_args=-go_naming_convention_external=go_default_library" \
...
}
This automatically applies certain constraints to all of our go_repository
rules.
However, in go_deps.from_file
, we need to apply a gazelle_override
to every repo (which ends up being hundreds).
The proposal is to add optional arguments to the from file tag:
go_deps.from_file(
go_mod = "//src/code.uber.internal:go.mod",
build_file_generation = "on",
build_extra_args = [
"-go_naming_convention_external=go_default_library",
],
directives = [
"gazelle:proto disable",
],
)
What did you expect to see?
What did you see instead?
Maybe we should just make gazelle:proto disable
and build_file_generation = "on"
the global defaults for Gazelle? @linzhp has brought that up before.