bazel: drop tools.go, use go.mod tool directive#285
Merged
sywhang merged 1 commit intouber-go:mainfrom Oct 5, 2025
Merged
Conversation
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
approved these changes
Oct 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since Go 1.24,
go get -toolis the preferred wayto 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: