9

OS: Windows 11 WSL2; IDE: Goland Latest

I am trying to open my IDE Goland, but I get this error when the IDE tries to index my project.

warning: GOPATH set to GOROOT (/usr/local/go) has no effect
go: mkdir /usr/local/go/pkg/mod: permission denied
go: github.com/MyCompany/common-backend@v1.0.56: mkdir /usr/local/go/pkg/mod: permission denied

though, I already set my go like this

 export GOROOT=/usr/local/go
 export GOPATH=$HOME/go
 export PATH=$PATH:/usr/local/go/bin

is that anything I miss for my WSL for Go Path?

niepl
  • 141
  • 1
  • 4

1 Answers1

-2

Step 1: Open your terminal check GOPATH

mrone.inc

go env | grep GOPATH  

Step 2: Copy your GOPATH and them to ~/.zshrc

mrone.inc

mrone.inc

sudo gedit ~/.zshrc

Step 3: Save and reboot bash

mrone.inc

source ~/.zshrc

Alternative: Make the current user as a root

mrone.inc

mrone.inc

sudo chown <user> -R  /root/
Tom Solid
  • 2,226
  • 1
  • 13
  • 32
Meckar
  • 1