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

mockgen chokes on embedded interfaces #10

Closed
RomanSaveljev opened this issue Sep 18, 2015 · 2 comments

Comments

@RomanSaveljev
Copy link

commented Sep 18, 2015

I was able to reduce my problem to this minimal case:

package test

import (
    "io"
)

type Iface interface {
    io.WriteCloser
}

Then mockgen fails:

$ $GOPATH/bin/mockgen -source iface.go -package test
2015/09/18 12:16:35 Loading input failed: iface.go:8:5: unknown embedded interface io.WriteCloser
$ $GOPATH/bin/mockgen -imports io=io -source iface.go -package test
2015/09/18 12:16:23 Loading input failed: iface.go:8:5: unknown embedded interface io.WriteCloser

Thanks for looking into the issue

@RomanSaveljev

This comment has been minimized.

Copy link
Author

commented Sep 18, 2015

Seems to work in reflect mode:

$ $GOPATH/bin/mockgen test Iface
...

This is enough for me, feel free to close, if no more action is deemed

@dsymonds

This comment has been minimized.

Copy link
Member

commented Sep 18, 2015

Yes, use reflect mode whenever possible. It's much more likely to get these kinds of cases right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.