Repository: go
Issue: cmd/go: go get makes too many requests to a Git repository via HTTP
Labels: NeedsInvestigation,modules

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.14 linux/amd64
</pre>

### Does this issue reproduce with the latest release?

Not tested.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ 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
</pre></details>

### 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