基础环境准备
# 安装git
apt install git
# 如果报错则用下面的安装
apt-get update
apt-get upgrade
apt-get install git
# 安装go
apt install golang-go
# 下载源码
git clone https://github.com/hanchuanchuan/goInception
cd goInception
make parser
# 构建二进制包
go build -o goInception tidb-server/main.go
出现下载不了的情况的时候
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct // 使用七牛云的
构建二进制包的时候遇到如下错误
verifying github.com/coreos/etcd@v3.3.10+incompatible: checksum mismatch
downloaded: h1:jFneRYjIvLMLhDLC
go.sum: h1:KjVWqrZ5U0wa3CxY2Ax
SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.
解决:
$ go clean -modcache
# 这里的project指的是goInception项目目录
$ cd project && rm go.sum
$ go mod tidy
# 重新build,构建二进制包
go build -o goInception tidb-server/main.go
cd /root/goInception/config
cp config.toml.default ../config.toml
cd ..
vim config.toml
# 启动
./goInception -config=./config.toml