moqueries / cli

Lock-free interface and function mocks for Go
BSD 3-Clause "New" or "Revised" License
13 stars 1 forks source link

could not import github.com/davegardnerisme/deephash (invalid package name: "") when generating mocks #28

Open myshkin5 opened 2 years ago

myshkin5 commented 2 years ago

github.com/davegardnerisme/deephash is a dependency of moqueries. Apparently Go dependency management is getting hung up on the transitive dependency (transitive to the project generating the mocks). Might be caused by the lack of go.mod in deephash (which has no dependencies other that the standard library).

WORKAROUND

$ go get github.com/davegardnerisme/deephash

Then retry generating the mocks.

myshkin5 commented 2 years ago

This is most likely caused by repeated calls to the code generator where the newly generated code gets parsed before dependencies are updated. The first code generation works fine but when the subsequent call attempts to parse the new code, it fails because it isn't aware of transitive dependencies yet. In any case the workaround mentioned above seems to do the trick.

In a future release, I plan to add a batch generator that should make this issue less of an issue.