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

Updating mockery to Go 1.17 #1

Merged
merged 1 commit into from
Jan 12, 2022
Merged

Updating mockery to Go 1.17 #1

merged 1 commit into from
Jan 12, 2022

Conversation

dangermike
Copy link
Contributor

  • Makefile fixes
    • clean wipes out fixtures
    • test requires fixtures
    • fixture creates target directory (if not present)
    • lint is a new target to run golangci-lint (if present)
    • install is compatible with the Go 1.17 install command
  • Made the linter happy
    • Removed some dead code
    • Ignore deadcode/unused on interfaces that are part of testing
    • Checking errors in a few places
    • Returning an error with the Config when parsing the command-line
    • Replaced deprecated golang.org/x/tools/packages.LoadSyntax with more specific, non-deprecated equivalents
  • Updated all the deps
  • Bumped version to 1.0.1

* Makefile fixes
   * `clean` wipes out fixtures
   * `test` requires fixtures
   * `fixture` creates target directory (if not present)
   * `lint` is a new target to run [golangci-lint](https://golangci-lint.run/) (if present)
   * `install` is compatible with the Go 1.17 `install` command
* Made the linter happy
   * Removed some dead code
   * Ignore deadcode/unused on interfaces that are part of testing
   * Checking errors in a few places
   * Returning an `error` with the `Config` when parsing the command-line
   * Replaced deprecated `golang.org/x/tools/packages.LoadSyntax` with more specific, non-deprecated equivalents
* Updated all the deps
* Bumped version to 1.0.1
@jcburley
Copy link

jcburley commented Jan 4, 2022

Quick question: what's driving the work on this, this fork being of an old mockery?

@aldelucca1
Copy link
Contributor

aldelucca1 commented Jan 4, 2022

Strongly typed mocks. The generator was update to put out type safe mocks that don't rely on the underlying On dynamic var arg signature

mockS3.Expect().ListObjects(input).ToReturn(output)

which is strongly typed and ensures that if the interface changes the compiler catches it, as opposed to

mockS3.On("ListObjects", input).Return(output)

where On takes interface{} and is vararg, which makes the compiler unable to know when the interface changes and makes tests very fragile

@jcburley
Copy link

jcburley commented Jan 4, 2022

Yeah, that's a really nice feature, would be great to have it in "official" mockery, and/or all the improvements there in this one! (The latter seemed like lots of work to me; not sure the official version is being actively maintained, so the former might be impractical.)

@dangermike
Copy link
Contributor Author

@aldelucca1 I'll do whatever you think is right here. I can't imagine we want to lose the strongly-typed features in this fork, but that also seems like a bigger change than the housekeeping I've done in this PR.

@dangermike
Copy link
Contributor Author

@kliu12 I don't have permissions to merge this thing. Can you press that big green button and make me one with everything?

@kliu12 kliu12 merged commit fc92dc2 into namely:master Jan 12, 2022
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.

4 participants