-
Notifications
You must be signed in to change notification settings - Fork 232
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(all): simplify mocks generation #1413
base: master
Are you sure you want to change the base?
Conversation
mock.gen.sh
to use go generate commands
3edebbc
to
a37996e
Compare
scripts/mock.gen.sh
Outdated
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.
do we have any sibling PR for avalanchego? This is a direct copy from avalanchego. I'd prefer to keep workflows in repos (coreth/subnet-evm/avalanchego) as similar as possible.
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.
Done in ava-labs/avalanchego#3628
I'm happy to wait for that PR to be discussed first and then merge the coreth and subnet-evm ones after.
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.
ava-labs/avalanchego#3628 merged, and I pushed a few commits here to make it as similar as possible 😉
0c66511
to
b001446
Compare
- Add missing license headers - Localized mockgen commands in the package where they are needed - Less shell scripting needed - Remove unneeded `source` commands for constants.sh and versions.sh
(Note using source mode was compulsory due to CGO)
0a20685
to
b466ccb
Compare
- requires a `tools.go` blank importing golang.org/x/mod/semver in order to have the `golang.org/x/mod` dependency satisfied for mockgen v0.4
- not used anywhere - different from avalanchego - does not work on windows' bash
f7b7acb
to
c2c5fb0
Compare
mock.gen.sh
to use go generate commands
Why this should be merged
💁 Sibling PR for coreth 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 themHow this was tested
CI passing (Golang unit tests > Mocks are up to date)
Need to be documented?
Yes in .github/CONTRIBUTING.md
Need to update RELEASES.md?
Not really