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: go get makes too many requests to a Git repository via HTTP #37988

Open
perillo opened this issue Mar 21, 2020 · 0 comments
Open

cmd/go: go get makes too many requests to a Git repository via HTTP #37988

perillo opened this issue Mar 21, 2020 · 0 comments

Comments

@perillo
Copy link

@perillo perillo commented Mar 21, 2020

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

$ go version
go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

Not tested.

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/manlio/.local/bin"
GOCACHE="/home/manlio/.cache/go-build"
GOENV="/home/manlio/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="*.local"
GONOPROXY=""
GONOSUMDB="*.local"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/src/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build504598020=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.14 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.14
uname -sr: Linux 5.5.9-arch1-2
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.31.
gdb --version: GNU gdb (GDB) 9.1

What did you do?

I have an HTTP server that implements both the go-get protocol and the Git HTTP protocol, and I noted that, when fetching from the repo-root reported after a go-get=1 request, go get makes more than one request to the same endpoint.

Here is a trace from the program, for go get test.local/simple:

/simple/info/refs?service=git-upload-pack
map[Accept:[*/*] Accept-Encoding:[deflate, gzip] Cache-Control:[no-cache] Pragma:[no-cache] User-Agent:[git/2.25.2]]

/simple/info/refs?service=git-upload-pack
map[Accept:[*/*] Accept-Encoding:[deflate, gzip] Cache-Control:[no-cache] Pragma:[no-cache] User-Agent:[git/2.25.2]]

/simple/git-upload-pack
map[Accept:[application/x-git-upload-pack-result] Accept-Encoding:[deflate, gzip] Content-Length:[192] Content-Type:[application/x-git-upload-pack-request] User-Agent:[git/2.25.2]]
/usr/bin/git-upload-pack --strict --stateless-rpc /home/manlio/src/go/src/test.local/simple/.git: exit status 128: fatal: the remote end hung up unexpectedly

/simple/git-upload-pack
map[Accept:[application/x-git-upload-pack-result] Accept-Encoding:[deflate, gzip] Content-Length:[201] Content-Type:[application/x-git-upload-pack-request] User-Agent:[git/2.25.2]]

GET http://test.local/simple returns:

<html>
  <head>
    <meta name="go-import"
          content="test.local/simple git http://test.local/:git/simple">
    </meta>
  </head>
</html>

git clone http://test.local/:git/simple only makes two requests.
It seems that go get makes an additional request, cancelling the previous one. Why?
The simple module only contains a go.mod file and a simple.go source file.

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
2 participants
You can’t perform that action at this time.