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

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

    Edit your ~/.bash_profile to add the following line:

    $ export GOPATH=$HOME/work
    

    Save and exit your editor. Then, source your ~/.bash_profile

    $ source ~/.bash_profile
    

    Note: Set the GOBIN path to generate a binary file when go install is run

    $ export GOBIN=$HOME/work/bin
    

提交回复
热议问题