Skip to content
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

Cannot create mock, getting "No packages found" error #98

Closed
svera opened this issue Apr 7, 2019 · 5 comments
Closed

Cannot create mock, getting "No packages found" error #98

svera opened this issue Apr 7, 2019 · 5 comments

Comments

@svera
Copy link

svera commented Apr 7, 2019

I'm trying to create mock for the following interface:

package vcs

type VCS interface {
...

Inside the interface dir (located at pkg/vcs/vcs.go) I run moq -out vcs_mock.go . VCS just to get the following error Couldn't load source package: No packages found. I've also tried using the go generator with the same results.

I'm using latest Go version (12.2) with the latest code in master (6cfb055).

@sitano
Copy link

sitano commented Apr 11, 2019

yep, not work for vendored pkgs as well

@sitano
Copy link

sitano commented Apr 11, 2019

it does not work at all with 1.12 with GOPATH even for not vendored pkgs

@tylerchr
Copy link

I ran into this same thing, and found that updating my copy of golang.org/x/tools/go/packages in $GOPATH and rebuilding moq resulted in a working build:

cd $GOPATH/src/github.com/matryer/moq
go get -u .
go install

I opened #101 to add a go.mod file, which should help avoid this sort of problem in the future.

@sudo-suhas
Copy link
Collaborator

sudo-suhas commented Jul 29, 2020

@svera are you still able to reproduce the issue with the latest version of moq? Apologies for responding so late.

@sudo-suhas
Copy link
Collaborator

Closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants