go install always attempts to use GOROOT and GOPATH is not listed under go env

前端 未结 4 1525
死守一世寂寞
死守一世寂寞 2020-12-31 13:19

I\'m having a quite frustrating problem with the GOPATH, which, despite being set in .profile, is not appearing when invoking go env,

4条回答
  •  清酒与你
    2020-12-31 14:03

    GOPATH and workspaces

    $ mkdir -p $HOME/dev/go/src
    $ mkdir -p $HOME/dev/go/bin
    

    In $HOME/.profile:

    export GOPATH=$HOME/dev/go:
    export PATH=$PATH:$HOME/dev/go/bin
    

    Then reboot or log out and log in.

    As soon as you have logged in, before anything else, run:

    $ env | grep -i '^GO'
    GOPATH=/home/me/dev/go
    $ cat $HOME/.profile
    

    What output do you get?

提交回复
热议问题