I've installed go v1.14.2 in my root, gave it permission and then moved the go folder to another drive
/mnt/d/goNow in the .profile and .bashrc file I've already exported the GOROOT as well as GOPATH and it looks like this.
export GOROOT=$mnt/d/go
export GOPATH=$mnt/d/go_space
export PATH=$PATH:/mnt/d/go/bin:$GOPATH/binOn running go version, I'm getting
go: cannot find GOROOT directory: /d/go 2 1 Answer
It should be:
export GOROOT=/mnt/d/go
export GOPATH=/mnt/d/go_space
export PATH=$PATH:/mnt/d/go/bin:$GOPATH/binBecause mnt is not set as anything, $mnt will return nothing.
Log out and log back in to apply the changes.
You see, PATH is an environment variable which is already set. You can run the following command to show what it is set to:
echo $PATHThere are also other variables, like HOME and USER too:
echo $HOME
echo $USERand you can set your own:
export foo=barand check it:
echo $fooand you can also add something like hello to foo like this:
export foo=hello:$foo
echo $fooor
export foo=$foo:hello
echo $foo 1