You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that importpath is no longer considered a mergeable attribute for go_test and go_binary, so it won't get removed, and the rule won't be considered empty. Currently, rules are considered empty if they have no attributes other than name and visibility.
We should expand the definition of empty: rules generated by Gazelle that have no srcs, deps, or embed attributes after merge should be deleted. This should catch go_binary with manually set goos and goarch as well.
The text was updated successfully, but these errors were encountered:
Gazelle will now delete a rule after merging when the following
conditions are true:
* No sources were found for the rule.
* After merging, none of the attributes "srcs", "deps", "embed", or
"proto" were defined.
* The rule has no "# keep" comment at the top level.
Fixesbazel-contrib#80
Gazelle will now delete a rule after merging when the following
conditions are true:
* No sources were found for the rule.
* After merging, none of the attributes "srcs", "deps", "embed", or
"proto" were defined.
* The rule has no "# keep" comment at the top level.
Fixes#80
For example, in https://github.com/kubernetes/sample-controller/blob/master/vendor/k8s.io/api/core/v1/BUILD, the
go_default_test
rule should be deleted since it has no sources. After running Gazelle, that rule is left behind withname
andimportpath
attributes.The problem is that
importpath
is no longer considered a mergeable attribute forgo_test
andgo_binary
, so it won't get removed, and the rule won't be considered empty. Currently, rules are considered empty if they have no attributes other thanname
andvisibility
.We should expand the definition of empty: rules generated by Gazelle that have no
srcs
,deps
, orembed
attributes after merge should be deleted. This should catchgo_binary
with manually setgoos
andgoarch
as well.The text was updated successfully, but these errors were encountered: