goproxy failed to get cloud.google.com/go
shuzhongling opened this issue · 1 comments
i download the master code if goproxy and build the goproxy executable grogram. i use go v1.17.2.
i use the build out goproxy grogram on my test server to proxy my go module request.
i use a test server as the proxy server, start the goproxy with the following command:
./goproxy -cacheDir /root/goproxy/cache -exclude git.szl.lvlv -listen 0.0.0.0:8081 -proxy https://goproxy.io
the
git.szl.lvlv
is my private test server's host name. and i set this hostname in my local computer also.
on the test server, the git env is as follow:
{
"AR": "ar",
"CC": "gcc",
"CGO_CFLAGS": "-g -O2",
"CGO_CPPFLAGS": "",
"CGO_CXXFLAGS": "-g -O2",
"CGO_ENABLED": "1",
"CGO_FFLAGS": "-g -O2",
"CGO_LDFLAGS": "-g -O2",
"CXX": "g++",
"GCCGO": "gccgo",
"GO111MODULE": "on",
"GOARCH": "amd64",
"GOBIN": "",
"GOCACHE": "/root/.cache/go-build",
"GOENV": "/root/.config/go/env",
"GOEXE": "",
"GOEXPERIMENT": "",
"GOFLAGS": "",
"GOGCCFLAGS": "-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2833939137=/tmp/go-build -gno-record-gcc-switches",
"GOHOSTARCH": "amd64",
"GOHOSTOS": "linux",
"GOINSECURE": "git.szl.lvlv",
"GOMOD": "/dev/null",
"GOMODCACHE": "/root/go/pkg/mod",
"GONOPROXY": "git.szl.lvlv",
"GONOSUMDB": "git.szl.lvlv",
"GOOS": "linux",
"GOPATH": "/root/go",
"GOPRIVATE": "git.szl.lvlv",
"GOPROXY": "https://goproxy.io,direct",
"GOROOT": "/root/go",
"GOSUMDB": "sum.golang.org",
"GOTMPDIR": "",
"GOTOOLDIR": "/root/go/pkg/tool/linux_amd64",
"GOVCS": "",
"GOVERSION": "go1.17",
"PKG_CONFIG": "pkg-config"
}
on my local computer, i clean all files in ${GOPATH}/pkg/mod
directory,
then i set the env with the followying command:
go env -w GOPROXY=http://git.szl.lvlv:8081
i want to use the goproxy of myself. to test this, i download the goproxy master branch also in my local computer, then i enter goproxy source root dir and enter the following command to build the goproxy.
go mod tidy
it turn out failed.
the output is the following:
D:\go\goproxy>go mod tidy
go: github.com/prometheus/client_golang@v1.9.0 requires
github.com/prometheus/common@v0.15.0 requires
github.com/go-kit/kit@v0.10.0 requires
github.com/lightstep/lightstep-tracer-go@v0.18.1 requires
google.golang.org/grpc@v1.21.0 requires
cloud.google.com/go@v0.26.0: Get "http://git.szl.lvlv:8081/cloud.google.com/go/@v/v0.26.0.mod": read tcp 192.168.43.167:57912->47.242.237.51:8081: wsarecv: An existing connection was forcibly closed by the remote host.
go: downloading github.com/prometheus/client_golang v1.9.0
go: downloading golang.org/x/mod v0.4.0
go: github.com/prometheus/client_golang@v1.9.0 requires
github.com/prometheus/common@v0.15.0 requires
github.com/go-kit/kit@v0.10.0 requires
github.com/lightstep/lightstep-tracer-go@v0.18.1 requires
google.golang.org/grpc@v1.21.0 requires
cloud.google.com/go@v0.26.0: Get "http://git.szl.lvlv:8081/cloud.google.com/go/@v/v0.26.0.mod": read tcp 192.168.43.167:57912->47.242.237.51:8081: wsarecv: An existing connection was forcibly closed by the remote host.
the go env in my local computer is:
{
"AR": "ar",
"CC": "gcc",
"CGO_CFLAGS": "-g -O2",
"CGO_CPPFLAGS": "",
"CGO_CXXFLAGS": "-g -O2",
"CGO_ENABLED": "1",
"CGO_FFLAGS": "-g -O2",
"CGO_LDFLAGS": "-g -O2",
"CXX": "g++",
"GCCGO": "gccgo",
"GO111MODULE": "on",
"GOARCH": "amd64",
"GOBIN": "",
"GOCACHE": "C:\\Users\\admin\\AppData\\Local\\go-build",
"GOENV": "C:\\Users\\admin\\AppData\\Roaming\\go\\env",
"GOEXE": ".exe",
"GOEXPERIMENT": "",
"GOFLAGS": "",
"GOGCCFLAGS": "-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\\Users\\admin\\AppData\\Local\\Temp\\go-build4053673841=/tmp/go-build -gno-record-gcc-switches",
"GOHOSTARCH": "amd64",
"GOHOSTOS": "windows",
"GOINSECURE": "",
"GOMOD": "NUL",
"GOMODCACHE": "C:\\Users\\admin\\go\\pkg\\mod",
"GONOPROXY": "",
"GONOSUMDB": "",
"GOOS": "windows",
"GOPATH": "C:\\Users\\admin\\go",
"GOPRIVATE": "",
"GOPROXY": "http://git.szl.lvlv:8081",
"GOROOT": "D:\\Program Files\\Go",
"GOSUMDB": "off",
"GOTMPDIR": "",
"GOTOOLDIR": "D:\\Program Files\\Go\\pkg\\tool\\windows_amd64",
"GOVCS": "",
"GOVERSION": "go1.17.2",
"PKG_CONFIG": "pkg-config"
}
but, when i change the env PROXY of my local computer to not use the proxy. use the public goproxy.cn
go env -w GOPROXY=goproxy.io,direct
go mod tidy
it work ok!
D:\go\goproxy>go mod tidy
go: downloading github.com/prometheus/client_golang v1.9.0
go: downloading golang.org/x/mod v0.4.0
go: downloading github.com/prometheus/common v0.15.0
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/protobuf v1.4.3
go: downloading github.com/prometheus/procfs v0.2.0
go: downloading golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading google.golang.org/protobuf v1.23.0
go: downloading github.com/google/go-cmp v0.4.0
i think if there is something wrong when is use the goproxy? or the goproxy route mode is something wrong?
$ go version go version go1.17.2 windows/amd64
As we all know the reason, use HTTPS please.