How do I SET the GOPATH environment variable on Ubuntu? What file must I edit?

前端 未结 25 2948
死守一世寂寞
死守一世寂寞 2020-11-28 00:45

I am trying to do a go get:

go get github.com/go-sql-driver/mysql

and it fails with the following error:

packa         


        
25条回答
  •  粉色の甜心
    2020-11-28 01:05

    New Way:

    Check out this answer.

    Old Way:

    Just add the following lines to ~/.bashrc and this will persist. However, you can use other paths you like as GOPATH instead of $HOME/go in my sample.

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

提交回复
热议问题