Reputation: 1626
I have set the following environmental variables in .bashrc
file
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/home/Rushikesh/GO
export PATH=$PATH:$GOPATH/bin
When I run following command:
go get github.com/nsf/gocode
I get the following error:
package github.com/nsf/gocode: mkdir /home/Rushikesh: permission denied
Upvotes: 4
Views: 6150
Reputation: 863
Facing go: could not create module cache: mkdir /home/josh: permission denied
issue in my Linux machine
RCA - invalid GOPATH
in goenv
Solution -
Step 1
pwd
Copy the working directory
Step 2
sudo vi ~/.bashrc
paste following command in .bashrc
file
export GOPATH="<your working directory or paste here the pwd output>"
eg - export GOPATH="/home/josh/workspace"
Step 3
source ~/.bashrc
Upvotes: 0
Reputation: 91
The problem is your configuration.
As reading form your comments Rushikesh is not user it is your directory. Then the GOPATH env variable should be
export GOPATH=/home/logged_user_name/Rushikesh/GO
Upvotes: 3