Skip to content

bazel: drop tools.go, use go.mod tool directive#285

Merged
sywhang merged 1 commit intouber-go:mainfrom
abhinav:bazel-go-tool
Oct 5, 2025
Merged

bazel: drop tools.go, use go.mod tool directive#285
sywhang merged 1 commit intouber-go:mainfrom
abhinav:bazel-go-tool

Conversation

@abhinav
Copy link
Contributor

@abhinav abhinav commented Oct 4, 2025

Since Go 1.24, go get -tool is the preferred way
to add and track tool dependencies.

This switches the Bazel submodule to use that mechanism
for the mockgen tool.

Switching to this required updating gazelle,
so I also updated rules_go and bazel_skylib,
and switched the go_sdk rule to use the version
from go.mod instead of specifying it directly.

Also deletes the unused _MOCKGEN_MODEL_LIB variable
from gomock.bzl.

Testing:

❯ bazel test ...
[..]
//tests/archive:client_test                                              PASSED in 0.3s
//tests/source:client_test                                               PASSED in 0.8s
//tests/source_with_importpath:client_test                               PASSED in 0.5s

Executed 3 out of 3 tests: 3 tests pass.

Since Go 1.24, `go get -tool` is the preferred way
to add and track tool dependencies.

This switches the Bazel submodule to use that mechanism
for the mockgen tool.

Switching to this required updating gazelle,
so I also updated rules_go and bazel_skylib,
and switched the go_sdk rule to use the version
from go.mod instead of specifying it directly.

Also deletes the unused _MOCKGEN_MODEL_LIB variable
from gomock.bzl.

Testing:

```
❯ bazel test ...
[..]
//tests/archive:client_test                                              PASSED in 0.3s
//tests/source:client_test                                               PASSED in 0.8s
//tests/source_with_importpath:client_test                               PASSED in 0.5s

Executed 3 out of 3 tests: 3 tests pass.
```
abhinav added a commit to abhinav/gomock that referenced this pull request Oct 4, 2025
The mockgen/model package was importable only for reflect mode.
In reflect mode, the generated code would import model,
which would then use reflection to export information about types.

Reflect mode is not a thing anymore,
so there's no need for model to be externally accessible.

Move it into an internal package and update all imports
*except* those inside the bazel/ directory for the following reasons:

- bazel/ is pinned to an older version of this package
- those references will be deleted in uber-go#285
@sywhang sywhang merged commit df17445 into uber-go:main Oct 5, 2025
5 checks passed
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