Skip to content

Conversation

@fasmat
Copy link
Contributor

@fasmat fasmat commented Jun 13, 2024

gomock.Cond at the moment expects an matcher function with the signature func(x any) bool requiring a manual cast to the expected type. By making this matcher generic the callback function can be typed removing the need for a manual cast to the expected type.

The change should be backwards compatible with existing tests using gomock.Cond.

@CLAassistant
Copy link

CLAassistant commented Jun 13, 2024

CLA assistant check
All committers have signed the CLA.

@fasmat fasmat changed the title Add generic Cond Matcher Make Cond Matcher generic Jun 13, 2024
@fasmat
Copy link
Contributor Author

fasmat commented Jun 27, 2024

Any feedback on this? @r-hang or @sywhang 🙂

@fasmat
Copy link
Contributor Author

fasmat commented Jun 28, 2024

or maybe @JacobOaks ?

Copy link
Contributor

@r-hang r-hang left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks for the contribution.

@r-hang r-hang merged commit 5021857 into uber-go:main Jul 1, 2024
@fasmat fasmat deleted the typed-cond branch July 1, 2024 07:52
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this pull request Oct 18, 2024
…eting-plugin-hetzner!135)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go.uber.org/mock](https://github.com/uber/mock) | require | minor | `v0.4.0` -> `v0.5.0` |

---

### Release Notes

<details>
<summary>uber/mock (go.uber.org/mock)</summary>

### [`v0.5.0`](https://github.com/uber-go/mock/releases/tag/v0.5.0)

[Compare Source](uber-go/mock@v0.4.0...v0.5.0)

#### 0.5.0 (15 Oct 2024)

##### Added

-   [#&#8203;153][]: Add `--write_command_comment` flag to specify whether to include
    `Generated by this command` comment.
-   [#&#8203;191][]: Add `--build_constraint` flag to add `//go:build` directives
    to generated mocks
-   [#&#8203;214][]: Add gob mode to support custom package loading techniques in place
    of --exec_only

##### Changed

-   [#&#8203;181][]: Made mockgen faster by changing flags passed to `go list`.
-   [#&#8203;183][]: Made `Cond` matcher generic.
-   [#&#8203;204][]: Removed `ISGOMOCK()` from generated mocks.
-   [#&#8203;207][]: Deprecated reflect mode and replaced it with the new package mode.

##### Fixed

-   [#&#8203;144][]: Fix a deadlock that can happen when mocking an interface that
    matches `fmt.Stringer`.
-   [#&#8203;168][]: Fix an issue where the "generated by" comment was being included
    in the package comment of generated mocks.

[#&#8203;144]: uber-go/mock#144

[#&#8203;153]: uber-go/mock#153

[#&#8203;168]: uber-go/mock#168

[#&#8203;181]: uber-go/mock#181

[#&#8203;183]: uber-go/mock#183

[#&#8203;191]: uber-go/mock#191

[#&#8203;204]: uber-go/mock#204

[#&#8203;207]: uber-go/mock#207

[#&#8203;214]: uber-go/mock#214

Thanks to [@&#8203;tulzke](https://github.com/tulzke) [@&#8203;JacobOaks](https://github.com/JacobOaks) [@&#8203;ARR4N](https://github.com/ARR4N) [@&#8203;sashamelentyev](https://github.com/sashamelentyev) [@&#8203;sywhang](https://github.com/sywhang) [@&#8203;fasmat](https://github.com/fasmat)
[@&#8203;eyasy1217](https://github.com/eyasy1217) [@&#8203;ghouscht](https://github.com/ghouscht) [@&#8203;tie](https://github.com/tie) [@&#8203;Neo2308](https://github.com/Neo2308) [@&#8203;carson-brill](https://github.com/carson-brill) [@&#8203;alexandear](https://github.com/alexandear) [@&#8203;sodul](https://github.com/sodul)
[@&#8203;nbgraham](https://github.com/nbgraham) for their contributions this release.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM4LjEyNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
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.

3 participants