xd9tuw
Last Updated: February 25, 2016
·
2.15K
· aniljava
1b1205526f20d488ea109ddf3c64f725

intellij $GOPATH $GOROOT fix

idea intellij go plugin does not accept custom GOPATH, this .bashrc function is to synchronize the GOPATH with GOROOT.

Requires GOPATH and GOROOT pre defined. Replace linux_amd64 with your archetecture.

goup to copy to GOROOT, and godown to remove them (required for go install on GOPATH).

function goup {
ls -1 $GOPATH/pkg/linux_amd64/ | xargs -I {} ln -s $GOPATH/pkg/linux_amd64/{} $GOROOT/pkg/linux_amd64/{}
  ls -1 $GOPATH/src/ | xargs -I {} ln -s $GOPATH/src/{}/ $GOROOT/src/pkg/{}
}
function godown {
  ls -1 $GOPATH/src/ | xargs -I {} rm --f $GOROOT/src/pkg/{}
  ls -1 $GOPATH/src/ | xargs -I {} rm --f $GOROOT/pkg/linux_amd64/{}
}
Say Thanks
Respond

1 Response
Add your response

12256
8a7f931317c05a5a1f599f6951142adb

other solution:
idea -> Project Structure -> SDKs -> Go SDK ... ->
Classpath and Sourcepath add $GOPATH src and pkg dir

over 1 year ago ·