golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.24k stars 17.57k forks source link

cmd/go: 'go get -u' has problems updating vendored git submodules from commit 3ce05d2 onward #21497

Closed siebenmann closed 6 years ago

siebenmann commented 7 years ago

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

This happens with the latest git tip go version devel +b5dab2b, and this specific form of the issue started happening from devel +3ce05d2 onward.

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

GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

Starting from commit 3ce05d2 'cmd/go: add support for Fossil SCM to go get', go get -u appears to attempt to update vendored git submodules but is apparently trying to do it in a way that doesn't work. This may have been not working properly for some time but previously masked by the issue from #13657, which probably prevented go get -u from trying this git update of such submodules.

Here is a reproduction and output from it:

$ export GOPATH=/tmp/scr; mkdir $GOPATH
$ go get github.com/davecheney/httpstat

$ go get -u github.com/davecheney/httpstat
# cd /tmp/scr/src/github.com/davecheney/httpstat/vendor/github.com/fatih/color; git pull --ff-only
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

package github.com/davecheney/httpstat/vendor/github.com/fatih/color: exit status 1
# cd /tmp/scr/src/github.com/davecheney/httpstat/vendor/golang.org/x/net; git pull --ff-only
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

package github.com/davecheney/httpstat/vendor/golang.org/x/net/http2: exit status 1
rsc commented 6 years ago

Seems to have been fixed:

r$ export GOPATH=/tmp/scr; mkdir $GOPATH
r$ go get github.com/davecheney/httpstat
r$ go get -u github.com/davecheney/httpstat
r$