Skip to content

Commit

Permalink
Disable protobuf generation for more modules (#1514)
Browse files Browse the repository at this point in the history
* Correct "go_deps.module" tag class attribute docs

In the deprecation notice, mention the "gazelle_overrides" tag's
"directives" attribute as the suggested target for the customizations
to move.

* Satisfy buildifier's formatting preferences

* Disable protobuf generation for more modules

Include the "k8s.io/apiextensions-apiserver" Go module in the set for
which we disable generation of Protocol Buffers files.
  • Loading branch information
seh authored Apr 25, 2023
1 parent c3cf70c commit 824d01b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions internal/bzlmod/directives.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ DEFAULT_DIRECTIVES_BY_PATH = {
"k8s.io/api": [
"gazelle:proto disable",
],
"k8s.io/apiextensions-apiserver": [
"gazelle:proto disable",
],
"k8s.io/apimachinery": [
"gazelle:proto disable",
],
Expand Down
9 changes: 5 additions & 4 deletions internal/bzlmod/go_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _safe_append_directives(module, gazelle_overrides, directives):
else:
existing = []
gazelle_overrides[module.path] = struct(
directives = existing + directives
directives = existing + directives,
)

def _get_directives(path, gazelle_overrides):
Expand Down Expand Up @@ -279,7 +279,8 @@ def _go_deps_impl(module_ctx):
for path, replace in replace_map.items():
if path in module_resolutions:
new_version = semver.to_comparable(replace.version)
module_resolutions[path] = with_replaced_or_new_fields(module_resolutions[path],
module_resolutions[path] = with_replaced_or_new_fields(
module_resolutions[path],
replace = replace.to_path,
version = new_version,
raw_version = replace.version,
Expand Down Expand Up @@ -397,7 +398,7 @@ _module_tag = tag_class(
repository.
Deprecated: Use the "gazelle:build_file_names" directive
via gazelle_override tag's "directive" attribute
via gazelle_override tag's "directives" attribute
instead.""",
default = "",
values = [
Expand All @@ -412,7 +413,7 @@ _module_tag = tag_class(
repository.
Deprecated: Use the "gazelle:proto" directive via
gazelle_override tag's "build_file_proto_mode" attribute
gazelle_override tag's "directives" attribute
instead.""",
default = "",
values = [
Expand Down

0 comments on commit 824d01b

Please sign in to comment.