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

running "mockgen": exec: "mockgen": executable file not found in $PATH #642

Closed
vitaly-zdanevich opened this issue May 12, 2022 · 8 comments

Comments

@vitaly-zdanevich
Copy link

vitaly-zdanevich commented May 12, 2022

I have this error on go generate ./...

BUT

$ mockgen --version
v1.6.0

$ which mockgen
/home/vitaly/go/bin/mockgen

First line of the file from error:
//go:generate mockgen -source=interface.go -destination=interface_mock.go -package=alarms

In go.mod I have:
github.com/golang/mock v1.6.0

go mod tidy do nothing.

go 1.17.8

Gentoo Linux

Bash

@codyoss
Copy link
Member

codyoss commented May 12, 2022

Sounds like you may need to add mockgen to your PATH. Please take a look at the note in the installation instructions. Hope that helps!

@vitaly-zdanevich
Copy link
Author

In my PATH I already have PATH=~/go/bin

@codyoss
Copy link
Member

codyoss commented May 12, 2022

@vitaly-zdanevich what happens when you type which mockgen in your terminal?

@vitaly-zdanevich
Copy link
Author

As in original post:

/home/vitaly/go/bin/mockgen

@codyoss
Copy link
Member

codyoss commented May 12, 2022

Does it work if you manually run the command from you terminal instead of go generate?

@vitaly-zdanevich
Copy link
Author

Yes.

@vitaly-zdanevich
Copy link
Author

SOLVED. Problem was that in PATH I had ~/go/bin but must be /home/vitaly/go/bin/

@vitaly-zdanevich
Copy link
Author

Did a related PR #644

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

No branches or pull requests

2 participants