-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
bazel,kvclient/rangefeed,util/log: stop using source mockgen generation #75806
Merged
craig
merged 1 commit into
cockroachdb:master
from
ajwerner:ajwerner/fix-go-mocks-in-bazel
Feb 5, 2022
Merged
bazel,kvclient/rangefeed,util/log: stop using source mockgen generation #75806
craig
merged 1 commit into
cockroachdb:master
from
ajwerner:ajwerner/fix-go-mocks-in-bazel
Feb 5, 2022
Conversation
This file contains 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
ajwerner
force-pushed
the
ajwerner/fix-go-mocks-in-bazel
branch
2 times, most recently
from
February 2, 2022 03:26
d345382
to
cf77d93
Compare
rickystewart
approved these changes
Feb 2, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you just need to tweak the go:generate
stuff and then we're good:
[03:31:44 ](https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_Tests_CheckGeneratedCode/4275261?buildTab=log&focusLine=4746&linesState=4746) Detected an unknown //go:generate comment:
[03:31:44 ](https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_Tests_CheckGeneratedCode/4275261?buildTab=log&focusLine=4747&linesState=4747) pkg/cmd/roachtest/tests/drt.go://go:generate mockgen -package tests -destination drt_generated.go . PromClient
[03:31:44 ](https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_Tests_CheckGeneratedCode/4275261?buildTab=log&focusLine=4748&linesState=4748) Please ensure that the equivalent logic to generate these files is
[03:31:44 ](https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_Tests_CheckGeneratedCode/4275261?buildTab=log&focusLine=4749&linesState=4749) present in the Bazel build as well, then add the line to the
[03:31:44 ](https://teamcity.cockroachdb.com/buildConfiguration/Cockroach_Ci_Tests_CheckGeneratedCode/4275261?buildTab=log&focusLine=4750&linesState=4750) EXISTING_GO_GENERATE_COMMENTS in build/bazelutil/check.sh.
stevendanna
approved these changes
Feb 3, 2022
catj-cockroach
approved these changes
Feb 3, 2022
ajwerner
force-pushed
the
ajwerner/fix-go-mocks-in-bazel
branch
5 times, most recently
from
February 5, 2022 04:40
fa43cbd
to
f311114
Compare
The source mode for mockgen is maddening because it requires the entire go tree to be copied out. This is excedingly slow. We fix that by not using that mode. To remedy that we have to export the interfaces we're mocking. I can eat that. Ideally we'd put the log one into a build-tagged away file, but github.com/jmhodges/bazel_gomock doesn't provide a way for us to plumb tags into its generator. That would be easy to fix, but not right now. This commit also removes some references to the `--source` flag in go:generate directives where they weren't doing anything. This commit also removes some previously checked in generated mock files. I wonder if that's going to cause pain? Release note: None
ajwerner
force-pushed
the
ajwerner/fix-go-mocks-in-bazel
branch
from
February 5, 2022 05:43
f311114
to
4a4dfea
Compare
TFTR! bors r+ |
Build succeeded: |
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.
The source mode for mockgen is maddening because it requires the entire
go tree to be copied out. This is excedingly slow. We fix that by not using
that mode. To remedy that we have to export the interfaces we're mocking.
I can eat that.
Ideally we'd put the log one into a build-tagged away file, but
github.com/jmhodges/bazel_gomock doesn't provide a way for us to plumb tags
into its generator. That would be easy to fix, but not right now.
This commit also removes some references to the
--source
flag ingo:generate directives where they weren't doing anything.
Fixes: #71854
Release note: None