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

bzlmod: Fix repo name used by gopackagesdriver #3516

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Apr 3, 2023

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

Ensure that we always specify the correct repo name when invoking the aspect by injecting it via x_defs. This works even with Bzlmod (where users usually refer to rules_go as @rules_go, not @io_bazel_rules_go, but could choose any apparent repository name for it).

Also replace one instance of a hardcoded repo name (thanks @bricedp).

Which issues(s) does this PR fix?

Fixes #3515

Other notes for review

bricedp and others added 2 commits April 3, 2023 11:41
… instead of hard-coding `@io_bazel_rules_go` repo name.
This ensures that we always specify the correct repo name when invoking
the aspect, even with Bzlmod (where users usually refer to rules_go as
`@rules_go`, not `@io_bazel_rules_go`, but could choose any apparent
repository name for it).
@fmeum
Copy link
Collaborator Author

fmeum commented Apr 3, 2023

@tyler-french Could you review and check that this works at Uber (ideally with and without Bzlmod)?

@bricedp Could you check that this works for you even without the environment variable set?

@bricedp
Copy link
Contributor

bricedp commented Apr 3, 2023

Thanks @fmeum! Confirming that this works without the GOPACKAGESDRIVER_RULES_GO_REPOSITORY_NAME environment variable.

@tyler-french
Copy link
Contributor

Confirming this works at Uber without Bzlmod enabled. Currently, we don't have support for GPD with Bzlmod, so I am not able to test this change.

FYI @JamyDev @linzhp

We will work internally to enable GPC with Bzlmod

@fmeum fmeum merged commit ec5a27c into bazelbuild:master Apr 3, 2023
1 check passed
@fmeum fmeum deleted the 3515-repo-name-in-packages-driver branch April 3, 2023 15:54
linzhp pushed a commit that referenced this pull request Apr 20, 2023
* Reference `rulesGoRepositoryName` (sourced from environment variable) instead of hard-coding `@io_bazel_rules_go` repo name.

* gopackagesdriver: Inject rules_go repo name via x_defs

This ensures that we always specify the correct repo name when invoking
the aspect, even with Bzlmod (where users usually refer to rules_go as
`@rules_go`, not `@io_bazel_rules_go`, but could choose any apparent
repository name for it).

---------

Co-authored-by: Brice <33697112+bricedp@users.noreply.github.com>
tingilee pushed a commit to tingilee/rules_go that referenced this pull request Jul 19, 2023
* Reference `rulesGoRepositoryName` (sourced from environment variable) instead of hard-coding `@io_bazel_rules_go` repo name.

* gopackagesdriver: Inject rules_go repo name via x_defs

This ensures that we always specify the correct repo name when invoking
the aspect, even with Bzlmod (where users usually refer to rules_go as
`@rules_go`, not `@io_bazel_rules_go`, but could choose any apparent
repository name for it).

---------

Co-authored-by: Brice <33697112+bricedp@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

//go/tools/gopackagesdriver fails on generated code when used with @rules_go as repo name
3 participants