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

how do you mock this with mockery or mockgen? #61

Closed
iDevoid opened this issue Jan 8, 2020 · 2 comments
Closed

how do you mock this with mockery or mockgen? #61

iDevoid opened this issue Jan 8, 2020 · 2 comments

Comments

@iDevoid
Copy link

iDevoid commented Jan 8, 2020

I want to try to use the standard library for mocking the interface, which is using mockgen.
but your package use tag versioning, which doesn't work with mockgen. I haven't try the mockery yet.
but i would like to know your solution instead of writing mock manually

here is the information about generating mock using mockgen
issue on mockgen issue 379

mockgen -destination=mocks/mock_user.go -source=internal/module/user/initiator.go
2020/01/07 17:24:53 Loading input failed: internal/module/user/initiator.go:54:6: failed parsing arguments: internal/module/user/initiator.go:54:12: unknown package "atreugo"

I am using "github.com/savsgio/atreugo/v10" for my http router
with interface

type Handler interface {
	Test(ctx *atreugo.RequestCtx) error
	CreateNewAccount(ctx *atreugo.RequestCtx) error
}

it seems that gomock doesn't recognize the tag versioning, so it results as panic because there is no atreugo inside of my imports.

Additional Information

  • gomock version: v1.3.1
  • golang version: go version go1.13.1 linux/amd64
@savsgio
Copy link
Owner

savsgio commented Jan 9, 2020

Hi @iDevoid,

I don't use any lib for create mocks. I don't know which is the problem about that you say.
All of my tests, I use manual mocks.

Sorry.

@savsgio savsgio closed this as completed Jan 9, 2020
@savsgio
Copy link
Owner

savsgio commented Jan 9, 2020

Maybe, the mockery and mockgen don't support go modules imports.

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

No branches or pull requests

2 participants