-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails with import errors with modules on Go 1.11 #213
Comments
@evanphx? This is a complete blocker on Go 1.11 with modules. |
We are seeing similar errors from mockery after trying Go 1.11 with modules
|
Any news ? This prevents us to use mockery. Thx ! |
Is there any working alternative for Go 1.11 with modules? |
@bliuchak yes, I use Docker... Dockerfile.generate FROM golang:1.10-alpine
RUN apk --no-cache --update add git make
RUN mkdir -p /go/src/github.com/your-name/your-service
WORKDIR /go/src/github.com/your-name/your-service
RUN go get github.com/vektra/mockery/.../
CMD ["make", "inner-generate"]
Makefile inner-generate:
@go get ./...
@go generate ./...
generate-builder:
@docker build -f Dockerfile.generate -t your-service-generate .
generate: generate-builder
@# hack for https://github.com/vektra/mockery/issues/213
@echo "Generate..."
@docker run --rm --name your-service-generate-running -v $(shell pwd):/go/src/github.com/your-name/your-service your-service-generate
|
It would be nice if you could add support to go mod |
We've decided to use counterfeiter (which does support Go modules) instead of mockery in a new go modules project in spite of the fact that we've been happily using mockery in non-module code. Some of mockery's features are missed, but at least counterfeiter works. We could potentially switch back to mockery if/when this issue is fixed. |
in order to support Go 1.11 modules. Fixes vektra#213.
Has there been a new release with PR #218? Doing standard install of mockery still has problem for me. |
@davisford It's merged. This project doesn't do releases or tags, unfortunately, but |
* switch to counterfeiter for mock generation because of vektra/mockery#213 * fix some tests which flake due to non-deterministic order of ranging over maps * update all the indirect requirements in go.mod which correspond to dependencies in riff Gopkg.lock to use the revision sha and run make to sanitise them * strip out Apache license headers Part of https://github.com/pivotal-cf/pfs/issues/44 Part of https://github.com/pivotal-cf/pfs/issues/45
* switch to counterfeiter for mock generation because of vektra/mockery#213 * fix some tests which flake due to non-deterministic order of ranging over maps * update all the indirect requirements in go.mod which correspond to dependencies in riff Gopkg.lock to use the revision sha and run make to sanitise them * strip out Apache license headers Part of pivotal/pfs#44 Part of pivotal/pfs#45
* switch to counterfeiter for mock generation because of vektra/mockery#213 * fix some tests which flake due to non-deterministic order of ranging over maps * update all the indirect requirements in go.mod which correspond to dependencies in riff Gopkg.lock to use the revision sha and run make to sanitise them * strip out Apache license headers Part of https://github.com/pivotal-cf/pfs/issues/44 Part of https://github.com/pivotal-cf/pfs/issues/45
If I have a simple file such as this that refers to an imported package:
then it fails with:
In other words, it's looking for the source in the old location, not in
$GOPATH/pkg/mod
.I'm able to reproduce this in a small Go program that uses
golang.org/x/tools/go/loader
to load files, and I can confirm that it does not work with Go modules. (E.g. see this issue for discussion.) Apparently thegolang.org/x/tools/go/loader
library has been superceded by golang.org/x/tools/go/packages, which is module-aware.The text was updated successfully, but these errors were encountered: