#!/usr/bin/env bash GO_VERSION=${1:?"Please input a version, example: 1.16"} ARCH=amd64 if [ ! -d /usr/local/go ]; then curl -fSLO --compressed "http://proxy.mirrors.xxx.org/golang/go$GO_VERSION.linux-$ARCH.tar.gz" && tar -zxf "go$GO_VERSION.linux-$ARCH.tar.gz" -C /usr/local/ && ln -sf /usr/local/go/bin/* /usr/local/bin/ && rm -rf "go$GO_VERSION.linux-$ARCH.tar.gz" else echo It has been installed. go version exit 2 fi # go env -u GO111MODULE GOPROXY GOSUMDB GOPRIVATE go env -w GO111MODULE=on GOPROXY=http://mirrors.xxx.org/nexus/repository/go-proxy,direct GOSUMDB=off GOPRIVATE=*.xxx.org,*.xxx.com go install golang.org/x/lint/golint@latest && go clean && echo 'export PATH=$PATH:`go env GOPATH`"/bin"' >> /etc/profile echo "For debugging, please: yum install gcc musl-dev; go install github.com/go-delve/delve/cmd/dlv@latest"
bash -s 1.20
标签:脚本,env,tar,安装,usr,&&,go,ARCH From: https://www.cnblogs.com/shiqi17/p/17988080