1.下载 go-chassis 源码
test1280 $ git clone https://github.com/go-chassis/go-chassis
Initialized empty Git repository in /home/test1280/go-chassis/.git/
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 7132 (delta 8), reused 22 (delta 7), pack-reused 7079
Receiving objects: 100% (7132/7132), 2.59 MiB | 37 KiB/s, done.
Resolving deltas: 100% (4250/4250), done.
2.安装 go-chassis 源码
test1280 $ cd go-chassis/
test1280 $ go mod download
go: finding github.com/go-chassis/paas-lager v0.0.0-20181123014243-005283cca84c
go: finding github.com/hashicorp/go-version v1.0.0
go: finding github.com/prometheus/common v0.2.0
go: finding github.com/golang/snappy v0.0.1
go: finding github.com/opentracing/opentracing-go v1.0.2
go: github.com/prometheus/[email protected]: unknown revision v0.2.0
go: github.com/hashicorp/[email protected]: unknown revision v1.0.0
go: finding github.com/emicklei/go-restful v2.8.0+incompatible
go: finding github.com/patrickmn/go-cache v2.1.0+incompatible
go: github.com/golang/[email protected]: unknown revision v0.0.1
go: github.com/emicklei/[email protected]+incompatible: unknown revision v2.8.0
go: github.com/opentracing/[email protected]: unknown revision v1.0.2
go: github.com/patrickmn/[email protected]+incompatible: unknown revision v2.1.0
go: finding github.com/smartystreets/goconvey v0.0.0-20170602164621-9e8dc3f972df
go: finding github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
go: finding github.com/stretchr/testify v1.2.2
……
有很多 unknown version,解决方法。
3.继续执行 go mod download
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/go-chassis/paas-lager v0.0.0-20181123014243-005283cca84c
go: finding github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1
go: finding github.com/cenkalti/backoff v2.0.0+incompatible
go: finding github.com/go-chassis/foundation v0.0.0-20190203091418-304855ea28bf
go: finding github.com/hashicorp/go-version v1.0.0
go: finding github.com/patrickmn/go-cache v2.1.0+incompatible
go: finding github.com/golang/snappy v0.0.1
go: finding github.com/smartystreets/goconvey v0.0.0-20170602164621-9e8dc3f972df
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/prometheus/common v0.2.0
go: finding github.com/gogo/protobuf v1.2.0
go: finding github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f
go: finding github.com/go-chassis/go-restful-swagger20 v0.0.0-20181221101811-a33c76fe4a6e
go: finding github.com/go-mesh/openlogging v0.0.0-20181122085847-3daf3ad8ed35
go: finding github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165
go: finding github.com/golang/protobuf v1.2.0
go: finding github.com/go-logfmt/logfmt v0.4.0
go: finding github.com/emicklei/go-restful v2.8.0+incompatible
go: finding github.com/gorilla/websocket v1.4.0
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304
go: go.uber.org/[email protected]: unrecognized import path "go.uber.org/ratelimit" (https fetch: Get https://go.uber.org/ratelimit?go-get=1: dial tcp 172.217.25.19:443: connect: connection refused)
go: finding github.com/sirupsen/logrus v1.2.0
go: finding github.com/prometheus/client_golang v0.9.1
go: finding github.com/json-iterator/go v1.1.5
go: finding github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/gogo/protobuf v1.1.1
go: finding github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: finding github.com/modern-go/reflect2 v1.0.1
go: finding github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding github.com/go-chassis/go-cc-client v0.5.0
go: finding github.com/julienschmidt/httprouter v1.2.0
go: finding github.com/pierrec/lz4 v2.0.5+incompatible
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515
go: finding github.com/opentracing/opentracing-go v1.0.2
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: finding github.com/go-chassis/go-archaius v0.7.0
go: finding github.com/go-kit/kit v0.8.0
go: finding github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d
go: finding github.com/go-logfmt/logfmt v0.3.0
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
^C
[test1280@localhost go-chassis]$
Q1:
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
针对此问题,执行:
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
即将 golang.org 映射到 github.com 项目中。
Q2:
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
针对此问题,执行:
[test1280@localhost go-chassis]$ go mod edit -replace=google.golang.org/[email protected]=github.com/grpc/[email protected]
即将 google.golang.org 映射到 github.com 项目中。
Q3:
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
同 Q1 解决:
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
4.继续执行 go mod download 试试看!
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/pierrec/lz4 v2.0.5+incompatible
go: finding github.com/go-chassis/go-cc-client v0.3.0
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding github.com/spf13/cast v1.2.0
go: finding github.com/golang/net v0.0.0-20181114220301-adae6a3d119a
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/grpc/grpc-go v1.16.0
go: finding github.com/golang/sys v0.0.0-20181116152217-5ac8a444bdc5
go: gopkg.in/[email protected]: unrecognized import path "gopkg.in/check.v1" (https fetch: Get https://gopkg.in/check.v1?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/go-kit/kit v0.8.0
go: go.uber.org/[email protected]: unrecognized import path "go.uber.org/ratelimit" (https fetch: Get https://go.uber.org/ratelimit?go-get=1: dial tcp 172.217.25.19:443: connect: connection refused)
go: finding github.com/gogo/protobuf v1.1.1
go: github.com/go-chassis/[email protected]: unknown revision v0.3.0
go: finding github.com/golang/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/go-chassis/go-chassis v1.2.2
go: github.com/fsnotify/[email protected]: unknown revision v1.4.7
go: github.com/go-kit/[email protected]: unknown revision v0.8.0
go: github.com/gogo/[email protected]: unknown revision v1.1.1
go: error loading module requirements
注意:
go: go.uber.org/[email protected]: unrecognized import path "go.uber.org/ratelimit" (https fetch: Get https://go.uber.org/ratelimit?go-get=1: dial tcp 172.217.25.19:443: connect: connection refused)
虽然有其他报错,但是我们先尝试解决已知的问题。有时候已知问题解决,其他奇奇怪怪的问题也就解决啦!
[test1280@localhost go-chassis]$ go mod edit -replace=go.uber.org/[email protected]=github.com/uber-go/[email protected]
5.继续执行 go mod download
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/gogo/protobuf v1.1.1
go: finding github.com/go-chassis/go-cc-client v0.3.0
go: finding github.com/go-kit/kit v0.8.0
go: finding github.com/uber-go/ratelimit v0.0.0-20180316092928-c15da0234277
go: finding github.com/golang/mock v1.1.1
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/stretchr/objx v0.1.1
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/prometheus/common v0.0.0-20190107103113-2998b132700a
go: finding github.com/prometheus/procfs v0.0.0-20190104112138-b1a0a9a36d74
go: finding github.com/DataDog/zstd v1.3.5
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/client9/misspell v0.3.4
go: finding github.com/golang/text v0.3.0
go: finding github.com/google/go-genproto v0.0.0-20180817151627-c66870c02cf8
go: finding github.com/go-chassis/go-cc-client v0.0.0-20181102101915-dea430061a34
go: finding github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e
go: cloud.google.com/[email protected]: unrecognized import path "cloud.google.com/go" (https fetch: Get https://cloud.google.com/go?go-get=1: dial tcp 216.58.195.78:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/tools" (https fetch: Get https://golang.org/x/tools?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/jtolds/gls v4.2.1+incompatible
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: connect: connection refused)
go: finding github.com/kisielk/gotool v1.0.0
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/appengine" (https fetch: Get https://google.golang.org/appengine?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/go-chassis/go-archaius v0.0.0-20181108111652-ab19b4eae276
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/oauth2" (https fetch: Get https://golang.org/x/oauth2?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/openzipkin-contrib/zipkin-go-opentracing v0.0.0-20180726151020-b85dc675b16b
go: finding github.com/konsorten/go-windows-terminal-sequences v1.0.1
go: finding github.com/golang/lint v0.0.0-20180702182130-06c8688daad7
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: finding github.com/eapache/queue v1.1.0
go: finding github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21
go: finding github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: finding github.com/Shopify/sarama v1.20.1
go: finding github.com/apache/thrift v0.0.0-20180829120307-8de3749235db
go: finding github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492
go: finding github.com/eapache/go-resiliency v1.1.0
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/lint" (https fetch: Get https://golang.org/x/lint?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: error loading module requirements
回到最初的原点(Q1),执行:
[test1280@localhost go-chassis]$ go mod edit -replace=cloud.google.com/[email protected]=github.com/GoogleCloudPlatform/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=google.golang.org/[email protected]=github.com/google/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=google.golang.org/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
6.继续执行 go mod download
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/golang/net v0.0.0-20180826012351-8a410e7b638d
go: finding github.com/golang/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding github.com/golang/sys v0.0.0-20180830151530-49385e6e1522
go: finding github.com/go-mesh/openlogging v0.0.0-20180912071658-0fd4707a75ab
go: finding github.com/golang/sys v0.0.0-20180824143301-4910a1d54f87
go: finding github.com/google/go-genproto v0.0.0-20181221175505-bd9b4fb69e2f
go: finding github.com/golang/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/golang/sys v0.0.0-20180905080454-ebe1bf3edb33
go: finding github.com/golang/appengine v1.1.0
go: finding github.com/golang/tools v0.0.0-20180828015842-6cd1fcedba52
go: finding github.com/GoogleCloudPlatform/google-cloud-go v0.26.0
go: finding github.com/go-chassis/go-chassis v1.0.2-0.20181108080311-6e96c66de2a1
go: finding github.com/golang/crypto v0.0.0-20180904163835-0709b304e793
go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connect: connection refused)
go: error loading module requirements
执行:
[test1280@localhost go-chassis]$ go mod edit -replace=golang.org/x/[email protected]=github.com/golang/[email protected]
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/golang/net v0.0.0-20181106065722-10aee1819953
go: finding github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf
go: finding github.com/prometheus/common v0.0.0-20181015124227-bcb74de08d37
go: finding github.com/prometheus/procfs v0.0.0-20180920065004-418d78d0b9a7
go: finding github.com/lyft/protoc-gen-validate v0.0.7
go: finding github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f
go: finding github.com/emicklei/go-restful-swagger12 v0.0.0-20170208215640-dcef7f557305
go: finding github.com/cactus/go-statsd-client v3.1.1+incompatible
go: finding github.com/envoyproxy/go-control-plane v0.5.0
go: finding github.com/shirou/gopsutil v0.0.0-20180801053943-8048a2e9c577
go: finding github.com/golang/net v0.0.0-20180824152047-4bcd98cce591
go: finding github.com/go-chassis/go-sc-client v0.0.0-20180925063328-78ad13b4fbef
go: finding github.com/DataDog/datadog-go v0.0.0-20180330214955-e67964b4021a
go: finding github.com/Shopify/sarama v1.18.0
go: finding github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c
go: finding github.com/go-mesh/openlogging v0.0.0-20180831021158-f5d1c4e7e506
go: finding github.com/grpc/grpc-go v1.14.0
go: finding github.com/spf13/pflag v1.0.3
go: k8s.io/[email protected]: unrecognized import path "k8s.io/apimachinery" (https fetch: Get https://k8s.io/apimachinery?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/prometheus/client_golang v0.8.0
go: k8s.io/[email protected]+incompatible: unrecognized import path "k8s.io/client-go" (https fetch: Get https://k8s.io/client-go?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/go-chassis/paas-lager v0.0.0-20180905100939-eff93e5e67db
go: finding github.com/go-chassis/paas-lager v0.0.0-20180831030822-312e8737a225
go: github.com/envoyproxy/[email protected]: unknown revision v0.5.0
go: finding github.com/hashicorp/golang-lru v0.5.0
go: github.com/Shopify/[email protected]: unknown revision v1.18.0
go: finding github.com/go-chassis/go-archaius v0.0.0-20181102103750-3dfd20d229f6
go: finding github.com/gorilla/websocket v1.3.0
go: github.com/lyft/[email protected]: unknown revision v0.0.7
go: k8s.io/[email protected]: unrecognized import path "k8s.io/api" (https fetch: Get https://k8s.io/api?go-get=1: net/http: TLS handshake timeout)
go: github.com/hashicorp/[email protected]: unknown revision v0.5.0
go: github.com/StackExchange/[email protected]: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/test1280/go/pkg/mod/cache/vcs/1e27c85e821f18cfbbce893a068065af7efff4ab86f7daf2a8de26813b7ffe62: exit status 128:
fatal: unable to access 'https://github.com/StackExchange/wmi/': SSL connect error
go: github.com/prometheus/[email protected]: git -c protocol.version=0 fetch --unshallow -f https://github.com/prometheus/common refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/test1280/go/pkg/mod/cache/vcs/78eeb4629eb558fa221be26a69bd8019d99c56c9d5e61a056019c7d4845bf714: exit status 128:
fatal: unable to access 'https://github.com/prometheus/common/': SSL connect error
go: github.com/gorilla/[email protected]: unknown revision v1.3.0
go: github.com/cactus/[email protected]+incompatible: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/test1280/go/pkg/mod/cache/vcs/c0920b8850964a068a863a13f0f10214cf863ff6a1adde6126d9cdef65ca3bb4: exit status 128:
fatal: unable to access 'https://github.com/cactus/go-statsd-client/': SSL connect error
go: github.com/spf13/[email protected]: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/test1280/go/pkg/mod/cache/vcs/389cbbf79b0218a16e6f902e349b1cabca23e0203c06f228d24031e72b6cf480: exit status 128:
fatal: unable to access 'https://github.com/spf13/pflag/': SSL connect error
go: github.com/gopherjs/[email protected]: git -c protocol.version=0 fetch --unshallow -f https://github.com/gopherjs/gopherjs refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/test1280/go/pkg/mod/cache/vcs/64690fb57f6c8566e98dbafa66110e0252c9a4adabb2d9f72d8c1723eb6637ad: exit status 128:
fatal: unable to access 'https://github.com/gopherjs/gopherjs/': SSL connect error
go: error loading module requirements
执行:
[test1280@localhost go-chassis]$ go mod edit -replace=k8s.io/[email protected]=github.com/kubernetes/[email protected]
[test1280@localhost go-chassis]$ go mod download
go: finding github.com/hashicorp/golang-lru v0.5.0
go: finding github.com/Shopify/sarama v1.18.0
go: finding github.com/envoyproxy/go-control-plane v0.5.0
go: finding github.com/cactus/go-statsd-client v3.1.1+incompatible
go: finding github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c
go: finding github.com/spf13/pflag v1.0.3
go: finding github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f
go: finding github.com/lyft/protoc-gen-validate v0.0.7
go: finding github.com/prometheus/common v0.0.0-20181015124227-bcb74de08d37
go: finding github.com/kubernetes/apimachinery v0.0.0-20180823151430-017bf4f8f588
go: finding github.com/go-chassis/go-chassis v0.8.3
go: finding github.com/go-chassis/go-chassis-plugins v0.0.0-20180731065901-7b05d8d2fbe6
go: finding github.com/go-ole/go-ole v1.2.1
go: finding github.com/json-iterator/go v0.0.0-20180806060727-1624edc4454b
go: finding github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
go: finding github.com/imdario/mergo v0.3.6
go: finding github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
go: finding github.com/pierrec/lz4 v2.0.3+incompatible
go: finding github.com/go-chassis/go-sc-client v0.0.0-20180831081217-8135c6df7f96
go: finding github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: finding github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c
go: k8s.io/[email protected]+incompatible: unrecognized import path "k8s.io/client-go" (https fetch: Get https://k8s.io/client-go?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/gopherjs/gopherjs v0.0.0-20180820052304-89baedc74dd7
go: finding github.com/gorilla/websocket v1.3.0
go: finding k8s.io/api v0.0.0-20180824172530-dd5c735cbff9
go: finding k8s.io/api v0.0.0-20180925152912-a191abe0b71e
go: finding github.com/smartystreets/assertions v0.0.0-20180301161246-7678a5452ebe
go: finding github.com/peterbourgon/diskv v2.0.1+incompatible
go: finding github.com/gogo/googleapis v1.1.0
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/spf13/pflag v1.0.2
go: k8s.io/[email protected]+incompatible: unrecognized import path "k8s.io/client-go" (https fetch: Get https://k8s.io/client-go?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/golang/time v0.0.0-20180412165947-fbb02b2291d2
go: finding github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
go: finding github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding github.com/lyft/protoc-gen-validate v0.0.6
go: finding github.com/go-chassis/go-archaius v0.0.0-20180831094429-1e6b20d2a085
go: finding github.com/go-chassis/go-cc-client v0.0.0-20180831085349-c2bb6cef1640
go: finding github.com/googleapis/gnostic v0.2.0
go: gopkg.in/[email protected]: unrecognized import path "gopkg.in/inf.v0" (https fetch: Get https://gopkg.in/inf.v0?go-get=1: net/http: TLS handshake timeout)
go: finding github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4
go: finding github.com/Shopify/sarama v1.17.0
go: finding github.com/golang/crypto v0.0.0-20180820150726-614d502a4dac
go: finding github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6
go: error loading module requirements
执行:
[test1280@localhost go-chassis]$ go mod edit -replace=k8s.io/[email protected]=github.com/kubernetes/[email protected]
[test1280@localhost go-chassis]$ go mod download
go: finding k8s.io/client-go v9.0.0
go: finding github.com/kubernetes/client-go v9.0.0
go: finding k8s.io/client-go v8.0.0+incompatible
go: finding gopkg.in/inf.v0 v0.9.1
go: finding golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
综上,在安装过程中会出现很多奇怪的问题,我们先捡我们熟悉的问题解决掉它,其他问题通常也就解决了。
总结:将被墙的第三方项目依赖包映射到 github.com 中对应的项目地址。
后记
问题
[test1280@localhost ~]$ cd $HOME/go-chassis/examples/rest/server
[test1280@localhost server]$ go build
go: github.com/golang/[email protected] used for two different module paths (github.com/golang/lint and golang.org/x/lint)
解决
[test1280@localhost server]$ cd $HOME/go-chassis/
[test1280@localhost go-chassis]$ go get github.com/golang/lint@latest
go: finding github.com/golang/lint latest
go: downloading github.com/golang/lint v0.0.0-20190301231843-5614ed5bae6f
再次尝试 go build 即可编译成功。