bazel-gazelle
bazel-gazelle copied to clipboard
Using the repo name rules_go removes proto embed from all go_library rules
What version of gazelle are you using?
0.37.0
What version of rules_go are you using?
0.48.0
What version of Bazel are you using?
7.2.0rc3
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
macOS arm64
What did you do?
-
I manually replaced all instances of
io_bazel_rules_gotorules_goin my repo. -
I removed the repo_name from the
rules_gobazel dep in MODULE.bazel.
# Before
bazel_dep(name = "rules_go", version = "0.48.0", repo_name = "io_bazel_rules_go")
# After
bazel_dep(name = "rules_go", version = "0.48.0")
What did you expect to see?
Running gazelle should do nothing.
What did you see instead?
Gazelle removed the go_library.embed for every go_proto_library embedded into a go_library.
Before
go_library(
name = "api",
srcs = [],
embed = [":api_go_proto"],
importpath = "github.com/arryved/simc/erp/api",
visibility = ["//visibility:public"],
)
After
go_library(
name = "api",
srcs = [],
importpath = "github.com/arryved/simc/erp/api",
visibility = ["//visibility:public"],
)
Debugging
The problem might be that `io_bazel_rules_go is hardcoded: https://github.com/bazelbuild/bazel-gazelle/blob/7d10bf7befce477f518056cfc502939000bea3fa/config/constants.go#L22