Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Skip rewriting output files if unchanged #626

Merged
merged 4 commits into from
Aug 12, 2022
Merged

Conversation

sodul
Copy link
Contributor

@sodul sodul commented Feb 22, 2022

When running mockgen with the output option this checks if the existing file content already exists and skips writing if there is nothing to change.

This will help reduce i/o when changing lots of files, but also reduce the re-indexing triggering in IDEs.

Solves #604

@sodul sodul requested a review from codyoss as a code owner February 22, 2022 23:28
@google-cla
Copy link

google-cla bot commented Feb 22, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@sodul
Copy link
Contributor Author

sodul commented Feb 28, 2022

Note that this duplicates an other pending PR #618. This one is slightly shorter but either one is fine by me @codyoss.

@sodul
Copy link
Contributor Author

sodul commented May 27, 2022

@codyoss let me know if you need anything else to review here. Thank you!

@sodul
Copy link
Contributor Author

sodul commented Aug 11, 2022

Gentle ping @codyoss This is a simple change that has a positive impact on IDEs and other tools that rescan on changed files.

mockgen/mockgen.go Outdated Show resolved Hide resolved
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change

When running mockgen with the output option this checks if the existing file content already exists and skips writing if there is nothing to change.

This will help reduce i/o when changing lots of files, but also reduce the re-indexing triggering in IDEs.

Solves golang#604
@sodul sodul requested a review from codyoss August 11, 2022 23:21
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last nit and then I think this is good to go, thanks!

mockgen/mockgen.go Outdated Show resolved Hide resolved
@sodul sodul requested a review from codyoss August 12, 2022 17:10
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@codyoss codyoss merged commit 5b45562 into golang:main Aug 12, 2022
bradleygore added a commit to bradleygore/gomock that referenced this pull request Oct 14, 2022
skip rewriting output files if unchanged (golang#626)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants