I am trying to install the mockgen package on go, but I keep receiving a permission denied without knowing why:
go install github.com/golang/mock/mockgen@v1.6.0
Output:
go install github.com/golang/mock/mockgen: copying /tmp/go-build3889221292/b001/exe/a.out: open /home/nocnoc/go/bin/mockgen: permission denied
I have tried using sudo or executing it as root, but I receive this error
sudo: go: command not found
My GOROOT is /usr/local/go and GOPATH is in my home directory. GO1111MODULE is also on.
How can I fix it? Everything else seems to run fine, and only mockgen seems to fail to install.