Skip to content

cmd/go: unexpected pseudo version (expected v1.0.1-(datetime) but v0.0.0-(datetime)) #26713

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

Closed
hajimehoshi opened this issue Jul 31, 2018 · 8 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@hajimehoshi
Copy link
Member

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11beta2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/hajimehoshi/sdk/go1.11beta2"
GOTMPDIR=""
GOTOOLDIR="/Users/hajimehoshi/sdk/go1.11beta2/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hajimehoshi/mygo/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b7/w11sqqrx7kx6fqfbn24wdsmh0000gn/T/go-build912053084=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

mkdir mygo
cd mygo
GO111MODULE=on go1.11beta2 mod -init -module example.com/m
GO111MODULE=on go1.11beta2 get github.com/hajimehoshi/gomoduletest@master

gomoduletest includes two commits: the first one is tagged v1.0.0 and the second one is not tagged.

What did you expect to see?

The contents of go.mod should be

module example.com/m

require github.com/hajimehoshi/gomoduletest v1.0.1-20180726180008-e605795390f0 // indirect

https://tip.golang.org/cmd/go/#hdr-Pseudo_versions says that the pseudo tag should be vX.Y.(Z+1). As the first commit is tagged v1.0.0, the next commits should be pseudo-versioned as v1.0.1-(datetime).

What did you see instead?

module example.com/m

require github.com/hajimehoshi/gomoduletest v0.0.0-20180726180008-e605795390f0 // indirect
@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jul 31, 2018
@myitcv myitcv added this to the Go1.11 milestone Jul 31, 2018
@myitcv
Copy link
Member

myitcv commented Jul 31, 2018

/cc @rsc @bcmills

@bcmills
Copy link
Contributor

bcmills commented Jul 31, 2018


$ go get -x github.com/hajimehoshi/gomoduletest@e605795390f06bb3052d2defb2ad112151819f22
mkdir -p /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4 # git2 https://github.com/hajimehoshi/gomoduletest
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git init --bare
0.034s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git init --bare
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git remote add origin https://github.com/hajimehoshi/gomoduletest
0.032s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git remote add origin https://github.com/hajimehoshi/gomoduletest
go: finding github.com/hajimehoshi/gomoduletest e605795390f06bb3052d2defb2ad112151819f22
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f06bb3052d2defb2ad112151819f22
0.004s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f06bb3052d2defb2ad112151819f22
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git tag -l
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git tag -l
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git ls-remote -q origin
0.118s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git ls-remote -q origin
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git fetch -f --depth=1 origin e605795390f06bb3052d2defb2ad112151819f22:refs/dummy
0.278s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git fetch -f --depth=1 origin e605795390f06bb3052d2defb2ad112151819f22:refs/dummy
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f06bb3052d2defb2ad112151819f22
0.004s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f06bb3052d2defb2ad112151819f22
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git describe --first-parent --tags --always --abbrev=0 --match v[0-9]*.[0-9]*.[0-9]* --tags e605795390f06bb3052d2defb2ad112151819f22
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git describe --first-parent --tags --always --abbrev=0 --match v[0-9]*.[0-9]*.[0-9]* --tags e605795390f06bb3052d2defb2ad112151819f22
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f0
0.004s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c log.showsignature=false log -n1 --format=format:%H %ct %D e605795390f0
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
go: downloading github.com/hajimehoshi/gomoduletest v0.0.0-20180726180008-e605795390f0
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
0.003s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git cat-file blob e605795390f06bb3052d2defb2ad112151819f22:go.mod
cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ e605795390f06bb3052d2defb2ad112151819f22
0.004s # cd /usr/local/google/home/bcmills/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ e605795390f06bb3052d2defb2ad112151819f22
WORK=/tmp/go-build112155607

@bcmills
Copy link
Contributor

bcmills commented Jul 31, 2018

Looks like we're not fetching enough history by that point: git claims not to know about the parent commit at all.

~/src/mod/cache/vcs/b2155df3155ea322687f667f59b4e0c0d9decf121b9fc5c161a8fccaf22e54b4$ git describe --tags --always --abbrev=0 --tags ec09dae00f2470c156e01818ec915c6f176bcdbd
fatal: ec09dae00f2470c156e01818ec915c6f176bcdbd is neither a commit nor blob

@bcmills bcmills self-assigned this Jul 31, 2018
@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. release-blocker and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 31, 2018
@bcmills
Copy link
Contributor

bcmills commented Jul 31, 2018

I can reproduce the symptoms by reversing the order of test cases in the mod_get_pseudo test.

@bcmills
Copy link
Contributor

bcmills commented Jul 31, 2018

Anybody with an old (e.g. Ubuntu) git version want to test the fix for modernisms?

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/126956 mentions this issue: cmd/go: fetch history as needed to resolve recent tags

@myitcv
Copy link
Member

myitcv commented Aug 1, 2018

@bcmills fix doesn't appear to have worked for old git, no:

docker run --rm -i -t ubuntu:16.04 bash
set -e
export DEBIAN_FRONTEND=noninteractive
adduser --disabled-password --gecos "" ubuntu
apt-get -y -qq update < /dev/null > /dev/null
apt-get -y -qq install git gcc curl gccgo < /dev/null > /dev/null
git --version
gv="git version 2.7.4"
[ "$(git --version)" == "$gv" ] || (echo "* Expected $gv" && false)
su ubuntu
cd /tmp
curl -sL https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz | tar -zx
export PATH=/tmp/go/bin:$PATH
mkdir tip
cd tip
git init
git pull -q https://go.googlesource.com/go refs/changes/56/126956/3
cd src
./make.bash
cd /tmp
export PATH=/tmp/tip/bin:$PATH
go version

mkdir mygo
cd mygo
GO111MODULE=on go mod -init -module example.com/m
GO111MODULE=on go get github.com/hajimehoshi/gomoduletest@master

cat go.mod

gives (at the time of writing):

module example.com/m

require github.com/hajimehoshi/gomoduletest v0.0.0-20180726180008-e605795390f0 // indirect

Probably worth getting a builder with "old" ubuntu to run all.bash as a failsafe pre the release of Go 1.11, too?

/cc @bradfitz

@bcmills
Copy link
Contributor

bcmills commented Aug 2, 2018

Ok, the current patchset (8) passes its test with both Git 2.18.0 and Git 2.7.4. No idea whether it works any further back than that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants