Add gob mode to support custom package loading techniques in place of --exec_only#214
Merged
JacobOaks merged 1 commit intouber-go:mainfrom Oct 17, 2024
Merged
Conversation
… `--exec_only` Change uber-go#207 replaced reflect mode with package mode. In doing so, we no longer had to create separate reflect programs that would encode the resulting package into a gob for the rest of mockgen to read from. Because of that, we removed the `--exec_only` flag. However, this flag was actually used to pass in programs that created gob encodings in other ways, allowing customization of the package loading and encoding portion of mockgen. As an alternative, this adds a new flag to mockgen `--model_gob`, which allows mockgen users to pass a path to a gob encoding of a `model.Package`, so that custom ways of loading package information can still be supported.
Closed
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 - [#​153][]: Add `--write_command_comment` flag to specify whether to include `Generated by this command` comment. - [#​191][]: Add `--build_constraint` flag to add `//go:build` directives to generated mocks - [#​214][]: Add gob mode to support custom package loading techniques in place of --exec_only ##### Changed - [#​181][]: Made mockgen faster by changing flags passed to `go list`. - [#​183][]: Made `Cond` matcher generic. - [#​204][]: Removed `ISGOMOCK()` from generated mocks. - [#​207][]: Deprecated reflect mode and replaced it with the new package mode. ##### Fixed - [#​144][]: Fix a deadlock that can happen when mocking an interface that matches `fmt.Stringer`. - [#​168][]: Fix an issue where the "generated by" comment was being included in the package comment of generated mocks. [#​144]: uber-go/mock#144 [#​153]: uber-go/mock#153 [#​168]: uber-go/mock#168 [#​181]: uber-go/mock#181 [#​183]: uber-go/mock#183 [#​191]: uber-go/mock#191 [#​204]: uber-go/mock#204 [#​207]: uber-go/mock#207 [#​214]: uber-go/mock#214 Thanks to [@​tulzke](https://github.com/tulzke) [@​JacobOaks](https://github.com/JacobOaks) [@​ARR4N](https://github.com/ARR4N) [@​sashamelentyev](https://github.com/sashamelentyev) [@​sywhang](https://github.com/sywhang) [@​fasmat](https://github.com/fasmat) [@​eyasy1217](https://github.com/eyasy1217) [@​ghouscht](https://github.com/ghouscht) [@​tie](https://github.com/tie) [@​Neo2308](https://github.com/Neo2308) [@​carson-brill](https://github.com/carson-brill) [@​alexandear](https://github.com/alexandear) [@​sodul](https://github.com/sodul) [@​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-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change #207 replaced reflect mode with package mode. In doing so, we no longer had to create separate reflect programs that would encode the resulting package into a gob for the rest of mockgen to read from.
Because of that, we removed the
--exec_onlyflag.However, this flag was actually used to pass in programs that created gob encodings in other ways, allowing customization of the package loading and encoding portion of mockgen. As an alternative, this adds a new flag to mockgen
--model_gob, which allows mockgen users to pass a path to a gob encoding of amodel.Package, so that custom programs for encoding package information can still be used in conjunction with mockgen.