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

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

    If you've setup anything that needs modification of environment variables e.g. Java, Go etc this will be very familiar.

    I will assume that you have the following directory structure somewhere as your Go path:

    \---[folder name]
        +---bin
        +---pkg
        \---src
    
    • open a new terminal
    • type sudo nano /etc/environment
    • find PATH=... and go the end of it and add a colon : after the last path then paste in your full go path e.g. /home/user/gocode

    and you're done, This should make it persistent through the system.

提交回复
热议问题