Actual behavior.
On go 1.14.
Running go generate ./... when the vendor dir is present fails with:
package github.com/golang/mock/mockgen: cannot find package "." in:
/Users/callisto/workspace/cretaceous/vendor/github.com/golang/mock/mockgen
mocks/doc.go:1: running "go": exit status 1
(I am guessing this is because mockgen depends on some runtime thing being there which would not be included when vendoring.)
We saw this appear after bumping to go 1.14. On go 1.13.x go generate ran fine.
Expected behavior
My mocks should be generated and no error should occur.
To Reproduce
I have set up a dumb example repo which mimics how we generate mocks in our codebase.
Silly interfaces found in dinosaur/dinosaur.go. Mocks should be generated in mocks/mock_dino.go.
To create mocks we keep a doc.go file in mocks/ and set the mocks to be generated in that package using the format:
//go:generate go run github.com/golang/mock/mockgen -package mocks -destination=./mock_dinos.go -source=../dinosaur/dinosaur.go
- Ensure you are running go 1.14
git clone https://github.com/Callisto13/cretaceous && cd cretaceous
- Note that the
vendor dir is not present.
- Observe that
go generate ./... works happily.
go mod vendor
- Observe that
go generate ./... fails with the error noted above.
- Remove the
vendor dir and run through again for lolz.
- Do the exact same with go 1.13.x and see that everything works fine with the
vendor dir present.
The behaviour is seen on all my team's machines.
Additional Information
- gomock mode (reflect or source): Source
- gomock version or git ref: v1.4.3
- golang version: 1.14
Triage Notes for the Maintainers
Actual behavior.
On go 1.14.
Running
go generate ./...when thevendordir is present fails with:(I am guessing this is because
mockgendepends on some runtime thing being there which would not be included when vendoring.)We saw this appear after bumping to go 1.14. On go 1.13.x
go generateran fine.Expected behavior
My mocks should be generated and no error should occur.
To Reproduce
I have set up a dumb example repo which mimics how we generate mocks in our codebase.
Silly interfaces found in
dinosaur/dinosaur.go. Mocks should be generated inmocks/mock_dino.go.To create mocks we keep a
doc.gofile inmocks/and set the mocks to be generated in that package using the format:git clone https://github.com/Callisto13/cretaceous && cd cretaceousvendordir is not present.go generate ./...works happily.go mod vendorgo generate ./...fails with the error noted above.vendordir and run through again for lolz.vendordir present.The behaviour is seen on all my team's machines.
Additional Information
Triage Notes for the Maintainers