搭建linux go 环境
tar -zxvf go1.12.1.linux-amd64.tar.gz -C /opt/
[root@localhost linux]# go version
go version go1.12.1 linux/amd64
[root@localhost linux]# go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/go_test"
vi /etc/profile
添加
export GOROOT=/opt/go
export GOPATH=/opt/go_test
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
source /etc/profile 生效
下载 etcd 源码
路径 /opt/go_test/src/github.com/etcd_git
linux 编译etcd
git clone 下载源码
git tag 列出所有版本号
git checkout +某版本号
下载源码 这里是成功的原因 使用 git下载源码
git clone git@github.com:etcd-io/etcd.git
git tag
git checkout -b v3.3.12 //切换分支
git checkout v3.3.12 进入分支
./build
[root@localhost etcd_git]# ./bin/etcd -version
etcd Version: 3.3.12
Git SHA: 07d1eb0
Go Version: go1.12.1
Go OS/Arch: linux/amd64

本文介绍如何在Linux系统中搭建Go运行环境,并详细展示了从下载源码到编译etcd的具体步骤。通过配置环境变量,确保Go环境正确设置;利用git工具下载etcd源码并选择特定版本进行编译。
1万+

被折叠的 条评论
为什么被折叠?



