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

Embed original interface into Mock struct #64

Open
arxeiss opened this issue Aug 17, 2023 · 3 comments · May be fixed by #171
Open

Embed original interface into Mock struct #64

arxeiss opened this issue Aug 17, 2023 · 3 comments · May be fixed by #171

Comments

@arxeiss
Copy link

arxeiss commented Aug 17, 2023

Requested feature

I would like to have option to embed original interface into generated Go structure.

Why the feature is needed

If the interface has unexported methods, the generated mock cannot be used as it does not fulfill the original interface. Embedding it however solves the issue. As discussed here https://groups.google.com/g/golang-nuts/c/6hpUErAfMHI

(Optional) Proposed solution

Solution should be pretty easy, as @stoikheia created PR in old repo golang/mock#683

@stoikheia
Copy link

@arxeiss
Thanks for open this issue with introducing my PR.

Your problem will be resolved if that suggestion is applied.
I'll port it to this repo as a PR this week end.

@ash2k
Copy link

ash2k commented Nov 29, 2023

Just encountered this issue. Trying to generate mocks for OpenTelemetry interfaces and they have embedded interfaces with private methods. Sigh.

Example: https://github.com/open-telemetry/opentelemetry-go/blob/98b32a6c3a87fbee5d34c063b9096f416b250897/metric/asyncint64.go#L42-L49

@lance6716
Copy link

lance6716 commented Mar 28, 2024

@stoikheia kindly ping. Now I meet this problem. And I also ported your PR but need you to sign CLA

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 a pull request may close this issue.

4 participants