-
Notifications
You must be signed in to change notification settings - Fork 141
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
chore(scripts): simplify mocks generation #721
Merged
Merged
+167
−100
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
darioush
reviewed
Dec 27, 2024
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.
IMO the license header is not needed, otherwise it's a great simplification.
darioush
reviewed
Dec 30, 2024
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.
Let's add the CI check to this PR as well and close 720.
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
from
December 30, 2024 16:10
b763d0c
to
9f1d7cb
Compare
darioush
approved these changes
Dec 30, 2024
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
2 times, most recently
from
December 30, 2024 17:08
127bcbd
to
d11e682
Compare
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
2 times, most recently
from
December 30, 2024 19:04
3d7c598
to
084214f
Compare
darioush
previously approved these changes
Dec 30, 2024
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
4 times, most recently
from
December 31, 2024 12:52
e98de07
to
994bf1c
Compare
4 tasks
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
from
January 6, 2025 10:01
994bf1c
to
81d16c3
Compare
qdm12
changed the title
chore(scripts): simplify
chore(scripts): simplify mocks generation
Jan 6, 2025
mock.gen.sh
to use go generate commands
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
4 times, most recently
from
January 6, 2025 16:44
b8238b6
to
9f6f6cd
Compare
(Note using source mode was compulsory due to CGO)
- requires a `tools.go` blank importing golang.org/x/tools/imports in order to have the `golang.org/x/tools` dependency satisfied for mockgen v0.4 - less future deltas when upgrading mockgen
qdm12
force-pushed
the
qdm12/mock-gen-script
branch
from
January 7, 2025 10:17
9f6f6cd
to
8fce33b
Compare
ceyonur
approved these changes
Jan 7, 2025
darioush
approved these changes
Jan 7, 2025
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.
Why this should be merged
💁 Sibling PR for subnet-evm so both repositories would look similar in this aspect
How this works
mocks_generate_test.go
file per package where mocks need to be generated, containing only//go:generate
commands for mock generation. Each command is relative to the current package directory//go:generate go run go.uber.org/mock/mockgen
to avoid requiring to pre-install mockgengo
command needed withgo generate -run "mockgen" ./...
scripts/mocks.gen.sh
andscripts/mocks.mockgen.txt
git add --intent-to-add --all
andgit diff --exit-code
//go:generate
generation command, by removing all of them before re-generating themtools.go
with anonymous import to allow using the same mockgen version automatically as the one specified in go.modHow this was tested
go generate -run mockgen ./...
Need to be documented?
Yes in .github/CONTRIBUTING.md
Need to update RELEASES.md?
Not really