搭建go语言开发环境

  1. 从官网下载tar.gz

    Downloads - The Go Programming Language (google.cn)

  2. 上传tar.gz到服务器/opt

  3. 解压tar.gz

  4. 配置/etc/profile

    在文件最后新增

    ##--------- Go --------##

    export GOROOT=/opt/go

    export GOPATH=/opt/gocode

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

  5. 新加用户:useradd test

  6. 切换用户:su - test

  7. 配置.bash_profile

    export GOPATH=~/gocode

    export GOPROXY=https://goproxy.cn

  8. 检查:go version


下一篇: