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

前端 未结 25 3044
死守一世寂寞
死守一世寂寞 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 00:55

    (Ubuntu)

    If you don’t set a GOPATH, the default will be used.

    You have to add $GOPATH/bin to your PATH to execute any binary installed in $GOPATH/bin, or you need to type $GOPATH/bin/the-command. Add this to your ~/.bash_profile

    export PATH=$GOPATH/bin:$PATH

    Current GOPATH command:

    go env GOPATH

    Changing the GOPATH command:

    export GOPATH=$HOME/your-desired-path

提交回复
热议问题