Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

unable to install mockgen following the instructions in README #308

Closed
dmitris opened this issue Jun 25, 2019 · 7 comments · Fixed by #312
Closed

unable to install mockgen following the instructions in README #308

dmitris opened this issue Jun 25, 2019 · 7 comments · Fixed by #312
Assignees

Comments

@dmitris
Copy link
Contributor

dmitris commented Jun 25, 2019

I'm unable to install mockgen following the instructions in https://github.com/golang/mock#installation:

$ go get -v github.com/golang/mock/gomock
github.com/golang/mock (download)
created GOPATH=/home/dmitris/go; see 'go help gopath'
github.com/golang/mock/gomock
$ go install -v github.com/golang/mock/mockgen
go/src/github.com/golang/mock/mockgen/parse.go:34:2: cannot find package "golang.org/x/tools/go/packages" in any of:
	/usr/local/go/src/golang.org/x/tools/go/packages (from $GOROOT)
	/home/dmitris/go/src/golang.org/x/tools/go/packages (from $GOPATH)

To make go install work, I had to also run:
go get -v golang.org/x/tools/go/packages. Alternatively, the following command works:
go get -v -u github.com/golang/mock/mockgen - maybe we could use it instead of the current pair of go get and go install?

go version output: go version go1.12.6 linux/amd64

@poy poy self-assigned this Jul 9, 2019
@poy
Copy link
Collaborator

poy commented Jul 9, 2019

Thanks for finding this!

I think this should be updated to a single step:

go get github.com/golang/mock/mockgen

We should probably also suggest you set GO111MODULE=on so that you use the go.mod file to grab the correct dependencies.

poy added a commit that referenced this issue Jul 9, 2019
@poy poy added the type: bug label Jul 9, 2019
poy added a commit that referenced this issue Sep 27, 2019
@poy poy closed this as completed in #312 Sep 27, 2019
poy added a commit that referenced this issue Sep 27, 2019
@ashu171996
Copy link

Mockgen is supported on above Go version < 1.16 Reference https://github.com/golang/mock#go-version--116

@codyoss
Copy link
Member

codyoss commented Oct 18, 2021

@ashu171996 mockgen currently works with 1.11+.

@dmitris
Copy link
Contributor Author

dmitris commented Oct 26, 2021

the current installation instructions work fine for me, thanks

@Houari-ym
Copy link

Mockgen not working for me using: go install github.com/golang/mock/[email protected] i have Go ver:
go version go1.18 linux/amd64, even when i run which mockgen No result

@jamestunnell
Copy link

jamestunnell commented May 3, 2022

Mockgen not working for me using: go install github.com/golang/mock/[email protected] i have Go ver: go version go1.18 linux/amd64, even when i run which mockgen No result

I had the same problem, and I just needed to make sure that $GOPATH/bin was being added to $PATH.

@seda1094
Copy link

seda1094 commented Nov 2, 2022

add export PATH=$PATH:$(go env GOPATH)/bin in .zshrc and try again

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

Successfully merging a pull request may close this issue.

7 participants