Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

How to write the mock result to a file in reflect mode #684

Open
someview opened this issue Nov 29, 2022 · 3 comments
Open

How to write the mock result to a file in reflect mode #684

someview opened this issue Nov 29, 2022 · 3 comments

Comments

@someview
Copy link

Actual behavior A clear and concise description of what the bug is.

Expected behavior A clear and concise description of what you expected to
happen.

To Reproduce Steps to reproduce the behavior

  1. ...
  2. ...

Additional Information

  • gomock mode (reflect or source):
  • gomock version or git ref:
  • golang version:

Triage Notes for the Maintainers

@someview
Copy link
Author

gomock mode (reflect or source):
//go:generate mockgen . DecPooler
type DecPooler interface {
Pooler
FreeToChan(msg *dto.DecMsg) //归还消息到池子中
AllocFromChan() *dto.DecMsg //从池子中分配消息
}
Is there any way to write the mock result to a file in reflect mode

@someview someview changed the title How TO How to write the mock result to a file in reflect mode Nov 29, 2022
@geoah
Copy link

geoah commented Dec 23, 2022

Was looking for this as well, can't do something like > out.go in go:generate and -destination doesn't seem to be supported in reflect mode.

@m-shev
Copy link

m-shev commented Dec 27, 2022

For writing the mock result to a file put the destination flag in the first place, like this

//go:generate mockgen -destination mock/resquest_test.go -package ${GOPACKAGE} some/package Request

package and interfaces always should be last

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants