美文网首页
golang环境

golang环境

作者: 百里江山 | 来源:发表于2020-05-18 16:06 被阅读0次
    $ vi /etc/profile.d/golang.sh
    # 将以下环境变量添加到profile最后面
    export GO111MODULE=on
    export GOPROXY=https://goproxy.cn,direct
    export GOROOT=/usr/local/go
    export PATH=$PATH:$GOROOT/bin
    export GOPATH=/data/gopath
    $ source /etc/profile
    
    
    #!/bin/bash
    wget -c https://studygolang.com/dl/golang/go1.14.3.linux-amd64.tar.gz
    tar -C /usr/local -zxvf go1.14.3.linux-amd64.tar.gz
    
    go_etc=/etc/profile.d/golang.sh
    touch $go_etc
    
    # shellcheck disable=SC2129
    echo "export GO111MODULE=on" >> $go_etc
    echo "export GOPROXY=https://goproxy.cn,direct" >> $go_etc
    echo "export GOROOT=/usr/local/go" >> $go_etc
    echo "export PATH=\$PATH:\$GOROOT/bin" >> $go_etc
    echo "export GOPATH=/data/gopath" >> $go_etc
    source /etc/profile
    go env
    
    

    相关文章

      网友评论

          本文标题:golang环境

          本文链接:https://www.haomeiwen.com/subject/xmzuohtx.html