First attempt to use go - how to change my workspace path?


can sb please tell me how to switch from “~/go/” to “~/.go/” ?

Thank you very much in advance.


export GOPATH=$GOPATH:~/.go

Thank you, but now I get: go: GOPATH entry is realtive; must be absolute path: “”.
I tried:
export GOPATH=$GOPATH:~/.go
export GOPATH=$GOPATH:~/.go/
export GOPATH=$GOPATH:/home/myname/.go
export GOPATH=$GOPATH:/home/myname/.go/

all of them return the same result when accessing go afterwards
Do I have to do something else?

it should be:

$> export GOPATH=$HOME/.go

or, optionally:

$> export GOPATH=$HOME/.go:$GOPATH

(if you want to keep the old $GOPATH workspace as a source of possible packages, and stack them up)


1 Like

Hey, thank you very much.
Not sure why passing $HOME works but passing the value of $HOME (echo $Home: /home/myname) does not work…
Anyway got a working solution :smiley:

Its not the $HOME, its the position of the old $GOPATH. If yoi prepend it and it is empty, you create an invalid entry in the list. But if it is at the end, it is ignored.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.