Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: "connection refused" from git2.likeit.cn #37943

Closed
xrfang opened this issue Mar 19, 2020 · 11 comments
Closed

cmd/go: "connection refused" from git2.likeit.cn #37943

xrfang opened this issue Mar 19, 2020 · 11 comments

Comments

@xrfang
Copy link

@xrfang xrfang commented Mar 19, 2020

What version of Go are you using (go version)?

go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

Yes. Using the latest release.

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xrfang/.cache/go-build"
GOENV="/home/xrfang/.config/go/env"
GOEXE=""
GOFLAGS="-insecure"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="git2.likeit.cn"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xrfang/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/xrfang/git/like2api/src/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build997224249=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I just try to migrate my project to use go mod:

  1. use go mod init to create an empty go.mod file
  2. run go build . in the project folder containing go.mod.

What did you expect to see?

Expect GO to download dependencies.

What did you see instead?

go: finding module for package git2.likeit.cn/go/audit
api_log.go:6:2: cannot find module providing package git2.likeit.cn/go/audit: module git2.likeit.cn/go/audit: git ls-remote -q origin in /home/xrfang/go/pkg/mod/cache/vcs/4a99938e270e3fc121e6cd17b568b994c52f92ae31f54fc644142689f6f2d8b7: exit status 128:
	fatal: unable to access 'https://git2.likeit.cn/:go/audit.git/': Failed to connect to git2.likeit.cn port 443: connection refused

i.e. the go module system insist on using HTTPS. As seen in the go env output above, the GOINSECURE variable is set to git2.likeit.cn.

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 19, 2020

This looks like a server issue. It appears that the server at git2.likeit.cn is returning go-import metadata pointing to the wrong repository URL.

Please verify that the server response follows the protocol described in https://tip.golang.org/cmd/go/#hdr-Remote_import_paths. (You can check the server response directly by running curl -sL https://git2.likeit.cn/go/audit?go-get=1.)

@bcmills bcmills added this to the Unplanned milestone Mar 19, 2020
@bcmills bcmills changed the title GOINSECURE does not work as expected cmd/go: "connection refused" from git2.likeit.cn Mar 19, 2020
@xrfang

This comment has been minimized.

Copy link
Author

@xrfang xrfang commented Mar 23, 2020

The server does NOT has https, but http returned 200:

$ curl -vsL https://git2.likeit.cn/go/audit?go-get=1

  • Trying 192.168.90.231:443...
  • TCP_NODELAY set
  • connect to 192.168.90.231 port 443 failed: 拒绝连接
  • Failed to connect to git2.likeit.cn port 443: 拒绝连接
  • Closing connection 0

$ curl -vsL http://git2.likeit.cn/go/audit?go-get=1

  • Trying 192.168.90.231:80...
  • TCP_NODELAY set
  • Connected to git2.likeit.cn (192.168.90.231) port 80 (#0)

GET /go/audit?go-get=1 HTTP/1.1
Host: git2.likeit.cn
User-Agent: curl/7.65.3
Accept: /

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 200 OK
    < Content-Type: text/html
    < Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
    < Set-Cookie: i_like_gitea=7a9321142eb6abbc; Path=/; HttpOnly
    < Set-Cookie: _csrf=QY55fAz3NT7dLuIyFVSOYQuA7nQ6MTU4NDk0ODk3NDE2Mzc3NjkwOQ%3D%3D; Path=/; Expires=Tue, 24 Mar 2020 07:36:14 GMT; HttpOnly
    < Date: Mon, 23 Mar 2020 07:36:14 GMT
    < Content-Length: 395
    <
    <!doctype html>
go get --insecure git2.likeit.cn/go/audit * Connection #0 to host git2.likeit.cn left intact
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 26, 2020

Did the curl -vsL http://git2.likeit.cn/go/audit?go-get=1 result include a <meta name="go-import" …> tag?

@xrfang

This comment has been minimized.

Copy link
Author

@xrfang xrfang commented Mar 27, 2020

@bcmills yes.

$ curl -vsL http://git2.likeit.cn/go/audit?go-get=1 
*   Trying 192.168.90.231:80...
* TCP_NODELAY set
* Connected to git2.likeit.cn (192.168.90.231) port 80 (#0)
> GET /go/audit?go-get=1 HTTP/1.1
> Host: git2.likeit.cn
> User-Agent: curl/7.65.3
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html
< Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647
< Set-Cookie: i_like_gitea=45fe72b3ffe60a55; Path=/; HttpOnly
< Set-Cookie: _csrf=6u7Yt-cdaE38e14afQ4Sxs3BkTo6MTU4NTI5MTQ0MzM2OTcyMzAyOQ    %3D%3D; Path=/; Expires=Sat, 28 Mar 2020 06:44:03 GMT; HttpOnly
< Date: Fri, 27 Mar 2020 06:44:03 GMT
< Content-Length: 395
< 
<!doctype html>
<html>
	<head>
    	<meta name="go-import" content="git2.likeit.cn/go/audit git http://git2.likeit.cn/go/audit.git">
	<meta name="go-source" content="git2.likeit.cn/go/audit _ http://git2.likeit.cn/go/audit/src/branch/master{/dir} http://git2.likeit.cn/go/audit/src/branch/master{/dir}/{file}#L{line}">
</head>
<body>
	go get --insecure git2.likeit.cn/go/audit
</body>
</html>
* Connection #0 to host git2.likeit.cn left intact
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Mar 27, 2020

Change https://golang.org/cl/225937 mentions this issue: cmd/go/internal/modfetch/codehost: remove unused GitRepo function

gopherbot pushed a commit that referenced this issue Mar 27, 2020
For #37943

Change-Id: Ib8ba5d846f41afc0047c33b8145918d93326cdd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/225937
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 27, 2020

I'm wondering where the : character in the URL https://git2.likeit.cn/:go/audit.git/ came from, and not having any luck finding it.

Are you still able to reproduce the original error message? (Is it possible that the server's go-import response has changed in the meantime?)

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 27, 2020

Another possibility — does your $HOME/.gitconfig contain an insteadOf rule for this host?

@xrfang

This comment has been minimized.

Copy link
Author

@xrfang xrfang commented Mar 30, 2020

I have tried insteadOf in gitconfig, but it was not there anymore. I will try to reproduce the problem.

@xrfang

This comment has been minimized.

Copy link
Author

@xrfang xrfang commented Mar 30, 2020

@bcmills the problem is reproducable:

$ go build ./...
go: finding module for package git2.likeit.cn/go/audit
go: finding module for package git2.likeit.cn/go/likesync
go: finding module for package git2.likeit.cn/go/pfs-cli
go: downloading git2.likeit.cn/go/likesync v1.5.3
go: downloading git2.likeit.cn/go/audit v0.0.0-20190919033733-1e4528554108
go: downloading git2.likeit.cn/go/pfs-cli v0.0.0-20190218015458-ed02cb0a38f0
api_log.go:6:2: git2.likeit.cn/go/audit@v0.0.0-20190919033733-1e4528554108: verifying module: git2.likeit.cn/go/audit@v0.0.0-20190919033733-1e4528554108: reading https://sum.golang.org/lookup/git2.likeit.cn/go/audit@v0.0.0-20190919033733-1e4528554108: 410 Gone
	server response: not found: git2.likeit.cn/go/audit@v0.0.0-20190919033733-1e4528554108: unrecognized import path "git2.likeit.cn/go/audit": https fetch: Get "https://git2.likeit.cn/go/audit?go-get=1": dial tcp 192.168.90.231:443: connect: connection refused
api_ordntfy.go:11:2: git2.likeit.cn/go/likesync@v1.5.3: verifying module: git2.likeit.cn/go/likesync@v1.5.3: reading https://sum.golang.org/lookup/git2.likeit.cn/go/likesync@v1.5.3: 410 Gone
	server response: not found: git2.likeit.cn/go/likesync@v1.5.3: unrecognized import path "git2.likeit.cn/go/likesync": https fetch: Get "https://git2.likeit.cn/go/likesync?go-get=1": dial tcp 192.168.90.231:443: connect: connection refused
pfs.go:9:2: git2.likeit.cn/go/pfs-cli@v0.0.0-20190218015458-ed02cb0a38f0: verifying module: git2.likeit.cn/go/pfs-cli@v0.0.0-20190218015458-ed02cb0a38f0: reading https://sum.golang.org/lookup/git2.likeit.cn/go/pfs-cli@v0.0.0-20190218015458-ed02cb0a38f0: 410 Gone
	server response: not found: git2.likeit.cn/go/pfs-cli@v0.0.0-20190218015458-ed02cb0a38f0: unrecognized import path "git2.likeit.cn/go/pfs-cli": https fetch: Get "https://git2.likeit.cn/go/pfs-cli?go-get=1": dial tcp 192.168.90.231:443: connect: connection refused
pfs.go:7:2: package kv is not in GOROOT (/usr/local/go/src/kv)

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 30, 2020

That error message is substantially different from the one you posted originally.

All of those errors are in checksum verification, which suggests that the module is not available to the public checksum database — probably you need to set GOPRIVATE for the prefix git2.likeit.cn/go.

@xrfang

This comment has been minimized.

Copy link
Author

@xrfang xrfang commented Mar 31, 2020

@bcmills setting both GOPRIVATE and GOINSECURE solved the problem. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.