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.
What changed?
Makefile
has been changed:gowrap
ormockgen
are being installed, binaries will be replaced by scripts fromscripts/gogenerate
folderscripts/gogenerate
folder has been added. This folder contains custom scripts designed to replace the original binaries invoked duringgo generate
commands.The changes will not be automatically used, as a developer require to run
make clean
to clean up binaries.Why?
In many cases, regenerating files during
go generate
is unnecessary if the source files (or other dependencies) havenot been updated. These scripts introduce a simple optimization: they check file modification times and skip regeneration if the output file is already up-to-date.
go-generate
is a mandatory step ofmake pr
command that should be executed each time when you push changes to your branch.make pr
has been speeded up 13x times from 2.25m to 18 seconds.Before the diff
➜ cadence git:(master) time make pr make tidy... make go-generate... make copyright... make fmt... make lint... make pr 259.16s user 578.92s system 577% cpu 2:25.08 total
After the diff
➜ cadence git:(speed-up-go-generate) time make pr make tidy... make go-generate... make copyright... make fmt... make lint... make pr 42.21s user 43.61s system 454% cpu 18.886 total
How did you test it?
make pr
on master and on branch to compare resultsPotential risks
go-generate
will not be called for changed files. Mostly these changes will make the source code not compilable or testable.