XiaoMi / Gaea

Gaea is a mysql proxy, it's developed by xiaomi b2c-dev team.
Apache License 2.0
2.62k stars 421 forks source link

编译报错 #180

Open earl86 opened 2 years ago

earl86 commented 2 years ago

centos7 go version go1.15.14 linux/amd64 编译报错

cd parser && make && cd .. make[1]: Entering directory `/root/Gaea-master/parser'

@echo "gofmt (simplify)"

@ gofmt -s -l -w . 2>&1 | awk '{print} END{if(NR>0) {exit 1}}'

make[1]: Leaving directory /root/Gaea-master/parser' fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git go build -o /root/Gaea-master/bin/gaea -pkgdir=/root/go/pkg/linux_amd64 -ldflags "-extldflags -static -X github.com/XiaoMi/Gaea/core.buildVersion=unknown -X github.com/XiaoMi/Gaea/core.buildGitRevision=unknown -X github.com/XiaoMi/Gaea/core.buildUser=root -X github.com/XiaoMi/Gaea/core.buildHost=cmysql15 -X github.com/XiaoMi/Gaea/core.buildStatus=Modified -X github.com/XiaoMi/Gaea/core.buildTime=2021-11-25--22:43:47 -X github.com/XiaoMi/Gaea/core.buildBranch= -X github.com/XiaoMi/Gaea/core.buildGitDirty=0" github.com/XiaoMi/Gaea/cmd/gaea fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git go build -o /root/Gaea-master/bin/gaea-cc -pkgdir=/root/go/pkg/linux_amd64 -ldflags "-extldflags -static -X github.com/XiaoMi/Gaea/core.buildVersion=unknown -X github.com/XiaoMi/Gaea/core.buildGitRevision=unknown -X github.com/XiaoMi/Gaea/core.buildUser=root -X github.com/XiaoMi/Gaea/core.buildHost=cmysql15 -X github.com/XiaoMi/Gaea/core.buildStatus=Modified -X github.com/XiaoMi/Gaea/core.buildTime=2021-11-25--22:43:52 -X github.com/XiaoMi/Gaea/core.buildBranch= -X github.com/XiaoMi/Gaea/core.buildGitDirty=0" github.com/XiaoMi/Gaea/cmd/gaea-cc go test -coverprofile=.coverage.out ./... ok github.com/XiaoMi/Gaea/backend 0.008s coverage: 9.1% of statements ? github.com/XiaoMi/Gaea/backend/mocks [no test files] ? github.com/XiaoMi/Gaea/cc [no test files] ? github.com/XiaoMi/Gaea/cc/proxy [no test files] ? github.com/XiaoMi/Gaea/cc/service [no test files] ok github.com/XiaoMi/Gaea/cmd/gaea 0.018s coverage: 14.0% of statements ? github.com/XiaoMi/Gaea/cmd/gaea-cc [no test files] ? github.com/XiaoMi/Gaea/core [no test files] ? github.com/XiaoMi/Gaea/core/errors [no test files] ? github.com/XiaoMi/Gaea/log [no test files] ? github.com/XiaoMi/Gaea/log/xlog [no test files] ok github.com/XiaoMi/Gaea/models 0.012s coverage: 76.4% of statements ok github.com/XiaoMi/Gaea/models/etcd 0.005s coverage: 4.4% of statements ? github.com/XiaoMi/Gaea/models/file [no test files] ok github.com/XiaoMi/Gaea/mysql 0.009s coverage: 34.7% of statements ok github.com/XiaoMi/Gaea/parser 0.099s coverage: 84.1% of statements ok github.com/XiaoMi/Gaea/parser/ast 0.050s coverage: 57.1% of statements ok github.com/XiaoMi/Gaea/parser/auth 0.004s coverage: 0.0% of statements [no tests to run] ok github.com/XiaoMi/Gaea/parser/format 0.005s coverage: 81.3% of statements ok github.com/XiaoMi/Gaea/parser/model 0.015s coverage: 53.6% of statements ok github.com/XiaoMi/Gaea/parser/opcode 0.006s coverage: 55.6% of statements ? github.com/XiaoMi/Gaea/parser/stmtctx [no test files] ok github.com/XiaoMi/Gaea/parser/terror 0.012s coverage: 75.9% of statements ok github.com/XiaoMi/Gaea/parser/tidb-types 0.040s coverage: 67.3% of statements ok github.com/XiaoMi/Gaea/parser/tidb-types/json 0.010s coverage: 81.4% of statements ok github.com/XiaoMi/Gaea/parser/tidb-types/parser_driver 0.011s coverage: 24.7% of statements ? github.com/XiaoMi/Gaea/parser/types [no test files] --- FAIL: TestSelectKingshardDateYear (0.00s) --- FAIL: TestSelectKingshardDateYear/select_*_from_tbl_ks_year_where_create_time_<=_1388505600 (0.00s) plan_test.go:114: not equal, expect: map[slice-0:map[db_ks:[SELECT * FROMtbl_ks_year_2014WHEREcreatetime`<=1388505600]]], actual: map[] --- FAIL: TestSelectKingshardDateYear/select_from_tbl_ks_year_where_createtime<=_1388505600#01 (0.00s) plan_test.go:114: not equal, expect: map[slice-0:map[db_ks:[SELECT FROM tbl_ks_year_2014 WHERE create_time<=1388505600]]], actual: map[] --- FAIL: TestSelectKingshardDateYear/select__from_tbl_ks_year_where_createtime>=_1514736000 (0.00s) plan_test.go:114: not equal, expect: map[slice-1:map[db_ks:[SELECT FROM tbl_ks_year_2018 WHERE create_time>=1514736000 SELECT FROM tbl_ks_year_2019 WHERE create_time>=1514736000]]], actual: map[slice-0:map[db_ks:[SELECT FROM tbl_ks_year_2017 WHERE create_time>=1514736000]] slice-1:map[db_ks:[SELECT FROM tbl_ks_year_2018 WHERE create_time>=1514736000 SELECT FROM tbl_ks_year_2019 WHERE create_time>=1514736000]]] --- FAIL: TestSelectKingshardDateYear/select__from_tbl_ks_year_where_createtime>=_1577808000 (0.00s) plan_test.go:114: not equal, expect: map[], actual: map[slice-1:map[db_ks:[SELECT FROM tbl_ks_year_2019 WHERE create_time>=1577808000]]] --- FAIL: TestSelectKingshardDateMonth (0.00s) --- FAIL: TestSelectKingshardDateMonth/select_*_from_tbl_ks_month_where_createtime<_1404144000 (0.00s) panic: runtime error: index out of range [1] with length 1 [recovered] panic: runtime error: index out of range [1] with length 1

goroutine 474 [running]: testing.tRunner.func1.1(0x9e9660, 0xc000024400) /usr/lib/golang/src/testing/testing.go:1072 +0x30d testing.tRunner.func1(0xc0000ecf00) /usr/lib/golang/src/testing/testing.go:1075 +0x41a panic(0x9e9660, 0xc000024400) /usr/lib/golang/src/runtime/panic.go:969 +0x1b9 github.com/XiaoMi/Gaea/proxy/plan.checkSQLs.func1(0xc00037e990, 0xc00037f380, 0xc00064e340) /root/Gaea-master/proxy/plan/plan_test.go:155 +0x39e github.com/XiaoMi/Gaea/proxy/plan.checkSQLs(0xc00037e990, 0xc00037f380, 0xc000021860) /root/Gaea-master/proxy/plan/plan_test.go:164 +0x42 github.com/XiaoMi/Gaea/proxy/plan.getTestFunc.func1(0xc0000ecf00) /root/Gaea-master/proxy/plan/plan_test.go:113 +0x433 testing.tRunner(0xc0000ecf00, 0xc000575f80) /usr/lib/golang/src/testing/testing.go:1123 +0xef created by testing.(*T).Run /usr/lib/golang/src/testing/testing.go:1168 +0x2b3 FAIL github.com/XiaoMi/Gaea/proxy/plan 0.205s ok github.com/XiaoMi/Gaea/proxy/router 0.021s coverage: 57.4% of statements ? github.com/XiaoMi/Gaea/proxy/sequence [no test files] ok github.com/XiaoMi/Gaea/proxy/server 0.025s coverage: 14.8% of statements ok github.com/XiaoMi/Gaea/stats 0.007s coverage: 70.2% of statements ok github.com/XiaoMi/Gaea/stats/prometheus 0.060s coverage: 97.1% of statements ok github.com/XiaoMi/Gaea/util 9.400s coverage: 51.4% of statements ok github.com/XiaoMi/Gaea/util/bucketpool 0.238s coverage: 93.9% of statements ok github.com/XiaoMi/Gaea/util/cache 0.003s coverage: 98.1% of statements ok github.com/XiaoMi/Gaea/util/crypto 0.003s coverage: 69.7% of statements ok github.com/XiaoMi/Gaea/util/hack 0.004s coverage: 55.0% of statements ? github.com/XiaoMi/Gaea/util/math [no test files] ok github.com/XiaoMi/Gaea/util/requests 0.004s coverage: 45.7% of statements ok github.com/XiaoMi/Gaea/util/sync2 0.031s coverage: 60.3% of statements ? github.com/XiaoMi/Gaea/util/testleak [no test files] ok github.com/XiaoMi/Gaea/util/timer 0.681s coverage: 96.2% of statements FAIL make: *** [test] Error 1

tiansin commented 2 years ago

你要把整个git仓库克隆下来进行编译.

BBJG001 commented 2 years ago

我也遇到了相同的报错,是按照 快速入门 的步骤操作的 git clone ~~~ cd Gaea && make 没有使用GOPROXY,配置了GOPROXY反而让我在拉取依赖的时候504