petergtz / pegomock

Pegomock is a powerful, yet simple mocking framework for the Go programming language
Apache License 2.0
253 stars 28 forks source link

undocumented dependency #43

Closed goblimey closed 7 years ago

goblimey commented 7 years ago

The latest version of pegomock causes one of my tests to fail due to a missing package:

package github.com/goblimey/animals/src/github.com/goblimey/animals/generated/crud/controllers/mouse (test) imports github.com/goblimey/animals/generated/crud/mocks/pegomock imports github.com/petergtz/pegomock imports github.com/onsi/gomega/format: cannot find package "github.com/onsi/gomega/format" in any of: /usr/local/go/src/github.com/onsi/gomega/format (from $GOROOT) /home/simon/goprojects/src/github.com/onsi/gomega/format (from $GOPATH) FAIL github.com/goblimey/animals/src/github.com/goblimey/animals/generated/crud/controllers/mouse [setup failed]

Obviously easy to fix, just do

go get github.com/onsi/gomega

So, not an urgent problem for me, but you need to add this step to your instructions.

If you make it unnecessary, please let me know and I will fix my own instructions.

I'm currently working on a tool that generates Go source code with unit tests. The tests use pegomock. If you are interested, take a look at https://github.com/goblimey/scaffolder.

By the way, concerning your question some weeks ago, yes I own both the godolatry and the goblimey github accounts and I have used both to submit issues. I will be using the goblimey account from now on.

Simon Ritchie

petergtz commented 7 years ago

@goblimey Thanks for reporting this. I wasn't aware of this behavior in go get. Updated the instructions. Not entirely happy with the solution yet, but at least this should avoid unexpected surprises like you had.

Does that solve the issue for you for now?

goblimey commented 7 years ago

The problem seems to be that when a user does a go get, it fetches the source code from the repository and compiles it, so they have to have all the dependencies installed.

I can't see your fix - I can't find any mention of gomega in your README.md. Have you got some more instructions somewhere else?

In your README.md, I suggest you change:

go get github.com/petergtz/pegomock
go install github.com/petergtz/pegomock/pegomock # yes, that repetition of pegomock is necessary

to go get github.com/onsi/gomega go get github.com/petergtz/pegomock go install github.com/petergtz/pegomock/pegomock # yes, that repetition of pegomock is necessary

Regards

Simon

petergtz commented 7 years ago

In your README.md, I suggest you change: ...

Not needed. The nice thing is that go get fetches dependencies recursively. You can test it. Delete your gomega package and copy and paste my instructions. It will get the gomega dependency as well.

goblimey commented 7 years ago

Ah, I see, you did change the download instructions.

Yes. That worked, so you I am closing this.