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

Generate imports in sorted path order #2

Closed
wants to merge 1 commit into from
Closed

Generate imports in sorted path order #2

wants to merge 1 commit into from

Conversation

peterstace
Copy link
Contributor

This change ensures that the import order is consistent between multiple runs of mockgen (rather than in random map iteration order). This is useful to help avoid noisy diffs for the case where multiple mocks are regenerated automatically but not all of the mocked interfaces have changed.

This ensures that the import order is consistent between multiple runs
of mockgen (rather than in random map iteration order).  This is useful
to help avoid noisy diffs for the case where multiple mocks are
regenerated automatically but not all of the mocked interfaces have
changed.
@dsymonds
Copy link
Contributor

Doesn't the generated code get pushed through the go/format package, and thus should already be sorted?

@peterstace
Copy link
Contributor Author

The generated code doesn't get pushed through go/format, although that way of doing it would be superior to what I've done here.

I'll close this pull request and put up a new one that uses go/format, since the two approaches are significantly different.

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