今天尝试Try Two Types of APIs,可以直接访问TiKV

执行该命令时

1
go get -u github.com/pingcap/tidb@master

得到

1
2
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: error loading module requirements

使用代理可以解决

试用rawkv时,得到

1
build rawkv-demo: cannot load github.com/pingcap/pd/pd-client: cannot find module providing package github.com/pingcap/pd/pd-client

解决:

1
GO111MODULE=on go get -u github.com/pingcap/tidb@master

其实文档开头提到了这个

执行示例代码时,得到

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
go: github.com/golang/[email protected]: parsing go.mod: unexpected module path "golang.org/x/lint"
go: finding github.com/prometheus/common v0.4.0
go: finding golang.org/x/tools v0.0.0-20190425150028-36563e24a262
go: finding golang.org/x/sys v0.0.0-20190606165138-5da285871e9c
go: finding golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a
go: finding google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7
go: finding github.com/ugorji/go v1.1.5-pre
go: finding github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024
go: finding github.com/prometheus/tsdb v0.7.1
go: finding golang.org/x/net v0.0.0-20190603091049-60506f45cf65
go: finding github.com/coreos/bbolt v1.3.2
go: finding github.com/coreos/go-semver v0.3.0
go: finding golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f
go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
go get: error loading module requirements

参考这个链接,解决:

1
go mod edit -replace github.com/golang/lint=golang.org/x/lint@latest

把那些前提配置到Dockerfile之后,启动docker还遇到

1
go get github.com/pingcap/tidb@master: git init --bare in /go/pkg/mod/cache/vcs/023ec28de881fe16123b69e600d28e8671b1fa6b70863a0d65ca08ea4bcc7d6d: exec: "git": executable file not found in $PATH

参考这个链接,解决:

1
2
FROM golang:alpine
RUN apk add git # 安装git