Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the repo name rules_go removes proto embed from all go_library rules #1823

Open
jschaf opened this issue Jun 6, 2024 · 1 comment
Open

Comments

@jschaf
Copy link

jschaf commented Jun 6, 2024

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?

  1. I manually replaced all instances of io_bazel_rules_go to rules_go in my repo.

  2. I removed the repo_name from the rules_go bazel 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:

RulesGoRepoName = "io_bazel_rules_go"

@fmeum
Copy link
Collaborator

fmeum commented Jun 6, 2024

Could you send a PR that adds a reproducer for this to some subdirectory of https://github.com/bazelbuild/bazel-gazelle/tree/master/tests/bcr/go_mod/proto, which uses a non-io_bazel_rules_go repo name? Then I could work on a fix. I have trouble reproducing this right now.

jschaf added a commit to jschaf/bazel-gazelle that referenced this issue Jun 7, 2024
- First commit: change the repo name from my_rules_go to io_bazel_rules_go.

- Second commit: change the repo name to rules_go and run gazelle.

Reproduces bazelbuild#1823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants