Skip to content

Mock for a builder interface #786

Answered by LandonTClipp
mesirendon asked this question in Q&A
Discussion options

You must be logged in to vote

I'm pretty sure what's happening here is that your mocks are living in a separate package yet trying to use an unexported type (myBuilder) from your original package. This can't work. This is why I generally recommend people generate mocks in the same package.

As far as not exposing them publicly, yes you can append _test to the filename, or use build tags such that the mocks are generated only when you have a test tag specified.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@mesirendon
Comment options

@mesirendon
Comment options

@LandonTClipp
Comment options

Answer selected by mesirendon
@mesirendon
Comment options

@mesirendon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants