Skip to content
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

Migrate from mockery to gomock #522

Merged
merged 4 commits into from Jul 29, 2019

Conversation

bentranter
Copy link
Member

Previously, we used mockery to generate the mock service implementations that we use in our command tests. This PR removes mockery in favour of gomock. There are several reasons we want to do this,

  1. gomock is actively maintained by the Go team, while mockery appears to be abandoned.
  2. gomock supports Go modules, while mockery does not. This allows to include gomock's mockgen tool in our vendor folder via Go modules, which in turn lets us build the binary from the local vendor folder on each invocation of the scripts/regenmocks.sh script. To put it more simply, this lets us run mockgen without having to make the user install that binary themselves.
  3. gomock is used elsewhere at DO, so the switch is nice for consistency's sake.

Updates the dependencies after the addition of gomock. Also tries to add
the gomock binary "mockgen" through a tools.go file with a build tag.
Regenerates the mocks so that they match the mocks a user would generate
exactly. They previously had a slight difference in formatting due to me
running goimports on them on save.
@bentranter bentranter requested a review from hilary July 29, 2019 17:40
Copy link
Contributor

@hilary hilary left a comment

Choose a reason for hiding this comment

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

:shipit:

@hilary hilary merged commit 47b3651 into digitalocean:master Jul 29, 2019
@bentranter bentranter deleted the apicli-98-mockery-to-gomock branch July 29, 2019 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants