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

Only rewrite output files if changes are needed. #604

@sodul

Description

@sodul

Actual behavior
We have a fairly large project and running mockgen takes several minutes. During that time all of the generated mock files get deleted and rewritten. This causes 2 issues:

  • if we run the mocks in parallel mockgen can try to read the files while they are being rewritten, causing mockgen to fail as it was trying to read the file. We worked around this by targeting directories in parallel but run mockgen sequentially within a directory.
  • our IDEs see the files being modified and re-index the codebase over and over, making the IDE mostly unusable while mockgen is running.

Expected behavior
If the output file already exist and has the same content mockgen should not rewrite it and leave it untouched.

To Reproduce Steps to reproduce the behavior

Just run mockgen as usual.

Additional Information

  • gomock 1.6.0
  • golang 1.17.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions