Skip to content

Revert "go_deps: allow local module replacements, with a flag (#2317)"#2321

Merged
jayconrod merged 3 commits intomasterfrom
revert-ignore-local-replaced-modules
Apr 5, 2026
Merged

Revert "go_deps: allow local module replacements, with a flag (#2317)"#2321
jayconrod merged 3 commits intomasterfrom
revert-ignore-local-replaced-modules

Conversation

@jayconrod
Copy link
Copy Markdown
Contributor

@jayconrod jayconrod commented Mar 29, 2026

This reverts commit 7c54844.

What type of PR is this?

Other

What package or component does this PR mostly affect?

go_deps

What does this PR do? Why is it needed?

Reverts #2317.

#2320 seems like a better solution for the same problem.

Which issues(s) does this PR fix?

For #2315

Other notes for review

Merge after #2320.

jayconrod added a commit that referenced this pull request Apr 5, 2026
**What type of PR is this?**

> Bug fix

**What package or component does this PR mostly affect?**

> all

**What does this PR do? Why is it needed?**

This lets us drop the `replace` from go.mod, which is blocking `go
install` in #2319. And it more accurately represents how Gazelle is
managing dependencies: we'll need to do this anyway if `v2/go.mod`
requires something that `go.mod` does not.

This requires a substantial change in `go_deps`. I've renamed the
`bazel_deps` list to `bazel_go_modules` to reflect the fact that with
`go.work`, Bazel modules and Go modules are not one-to-one: a Bazel
module like `gazelle` may contain multiple Go modules. We should not
generate `go_repository` definitions for these, nor should we warn about
selected version differences.

Unfortunately, we can't ignore `go.work` files outside the main module.
Gazelle's `deps` labels refer to `//v2/...` packages within the same
module; clients cannot have a different view of the module boundaries.

This change means that we don't need `ignore_local_replaced_modules`, so
reverting that in #2321 since it's not released yet.

**Which issues(s) does this PR fix?**

Fixes #2319

**Other notes for review**
@jayconrod jayconrod enabled auto-merge (squash) April 5, 2026 18:24
@jayconrod jayconrod merged commit cd1408c into master Apr 5, 2026
17 checks passed
@jayconrod jayconrod deleted the revert-ignore-local-replaced-modules branch April 5, 2026 20:51
wonderyl pushed a commit to wonderyl/bazel-gazelle that referenced this pull request Apr 13, 2026
…-contrib#2320)

**What type of PR is this?**

> Bug fix

**What package or component does this PR mostly affect?**

> all

**What does this PR do? Why is it needed?**

This lets us drop the `replace` from go.mod, which is blocking `go
install` in bazel-contrib#2319. And it more accurately represents how Gazelle is
managing dependencies: we'll need to do this anyway if `v2/go.mod`
requires something that `go.mod` does not.

This requires a substantial change in `go_deps`. I've renamed the
`bazel_deps` list to `bazel_go_modules` to reflect the fact that with
`go.work`, Bazel modules and Go modules are not one-to-one: a Bazel
module like `gazelle` may contain multiple Go modules. We should not
generate `go_repository` definitions for these, nor should we warn about
selected version differences.

Unfortunately, we can't ignore `go.work` files outside the main module.
Gazelle's `deps` labels refer to `//v2/...` packages within the same
module; clients cannot have a different view of the module boundaries.

This change means that we don't need `ignore_local_replaced_modules`, so
reverting that in bazel-contrib#2321 since it's not released yet.

**Which issues(s) does this PR fix?**

Fixes bazel-contrib#2319

**Other notes for review**
wonderyl pushed a commit to wonderyl/bazel-gazelle that referenced this pull request Apr 13, 2026
…contrib#2317)" (bazel-contrib#2321)

This reverts commit 7c54844.

**What type of PR is this?**

> Other

**What package or component does this PR mostly affect?**

> go_deps

**What does this PR do? Why is it needed?**

Reverts bazel-contrib#2317.

bazel-contrib#2320 seems like a better solution for the same problem.

**Which issues(s) does this PR fix?**

For bazel-contrib#2315

**Other notes for review**

Merge after bazel-contrib#2320.
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.

2 participants