golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.3k stars 610 forks source link

Mockgen on interface using cgo #303

Closed undercover87 closed 4 years ago

undercover87 commented 5 years ago

Hi, I'd like to generate a mock object for an inteface importing and using cgo, i.e. there are functions whose argument is C.some_type. The mock object is being generated alright (with mockgen) and naturally, "C" is also imported in the auto-generated mock file.

But when I run go test I'm getting a "cannot rename import "C" " error message coming from the auto-generated mock file.

Is it possible to bypass this? Am I missing something?

thanks

EDIT: for clarity.

poy commented 5 years ago

Can you provide an example. (Disclaimer: I don't believe we support it nor am I confident we will.)

codyoss commented 4 years ago

Closing this for now because of no response and I am not sure about compatibility with cgo.... If you do respond with an example though feel free to reopen this!