Go moq : running "moq": exec: "moq": executable file not found in $PATH


when trying the example of the moq framework, I get the following exception when I enter “go generate”:

example.go:5: running “moq”: exec: “moq”: executable file not found in $PATH

What should I do? I’m using Kubuntu 16.04

PS: I tried

export PATH=$PATH:/home/[…]/go/src/github.com/matryer/moq

without success


@sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:

export PATH=$PATH:/home/[…]/go/bin

and if it doesn’t work, check that moq was correctly installed.

Answered By – Racater

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published