gojuno / minimock

Powerful mock generation tool for Go programming language
MIT License
577 stars 38 forks source link

Does not work without GOPATH env variable #16

Closed AndreyBronin closed 5 years ago

AndreyBronin commented 5 years ago

Fails with error minimock: failed to detect import path of the ...: can't detect package for file: "..."

Workaround is GOPATH=`go env GOPATH` minimock -i path -o bla bla

hexdigest commented 5 years ago

@AndreyBronin Thanks for the bug report! Can you please update the minimock and confirm that the problem is fixed?

AndreyBronin commented 5 years ago

Now I get another error. I am using dep v0.5.0 instead go mod, go version go1.11.2 darwin/amd64

$ minimock -i github.com/insolar/insolar/network.HostNetwork -o ./testutils/network/ minimock: failed to detect import path of the ./testutils/network/: "/Users/bronin/go/src/github.com/insolar/insolar/testutils/network" is out of GOPATH and go.mod file is not found in any of the parent directories

workaround is not working now

hexdigest commented 5 years ago

@AndreyBronin The only solution I see in your case (using dep) is to add "/Users/bronin/go" to GOPATH, otherwise minimock won't be able to resolve neither ./testutils/network/ nor github.com/insolar/insolar/network

AndreyBronin commented 5 years ago

I checked again, dep works with workaround

hexdigest commented 5 years ago

@AndreyBronin this should be fixed now. Please check out the latest version of minimock (v2.0.0) and give it a try. Feel free to reopen this issue if the problem persists.