centos搭建golang+gin环境

下载解压

wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
tar zxvf go1.12.1.linux-amd64.tar.gz
mv go /usr/local/
cd /usr/local/go
mkdir -p /usr/local/go/workspacego/src/github.com/

vim /etc/profile

配置部分开始

export GOROOT=/usr/local/go
export GOBIN=$GOROOT/bin
export GOARCH=amd64
export GOOS=linux
export GOPATH=$GOROOT/workspacego
export PATH=.:$PATH:$GOBIN

配置部分结束

配置生效

source /etc/profile

下载源码

mkdir -p $GOPATH/src/golang.org/x/
cd $GOPATH/src/golang.org/x/
git clone https://github.com/golang/net.git net
git clone https://github.com/golang/sys.git sys

下载gin

mkdir -p $GOPATH/src/github.com/
git clone https://github.com/gin-gonic/gin.git

发表评论

电子邮件地址不会被公开。 必填项已用*标注