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: determined pseudo-version timestamp differs from the commit timestamp by a couple seconds #34405

Closed
MMulthaupt opened this issue Sep 19, 2019 · 3 comments

Comments

@MMulthaupt
Copy link

@MMulthaupt MMulthaupt commented Sep 19, 2019

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

go1.13 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/martin/.cache/go-build"
GOENV="/home/martin/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/martin/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/martin/gitlab/godown-builder/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-build325777527=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. Add the following to go.mod: require github.com/shirou/gopsutil e4ec7b275ada
  2. Run go mod tidy

What did you expect to see?

A pseudo-version with correct timestamp: v0.0.0-20190901111124-e4ec7b275ada

What did you see instead?

A pseudo-version with incorrect timestamp: v0.0.0-20190901111213-e4ec7b275ada

Additional information

Interestingly, the incorrect pseudo-version timestamp works. The correct one does not work.

Output of git log | grep -A 2 e4ec7b275ada within the module's repository:

commit e4ec7b275ada47ca32799106c2dba142d96aaf93
Author: Lomanic <Lomanic@users.noreply.github.com>
Date:   Sun Sep 1 13:11:24 2019 +0200
@heschik

This comment has been minimized.

Copy link
Contributor

@heschik heschik commented Sep 19, 2019

I don't understand why git is like it is, but here's the proximate cause:

$ git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' e4ec7b275ada
e4ec7b275ada47ca32799106c2dba142d96aaf93 1567336333 tag: v2.19.8
$ git log --date=unix e4ec7b275ada | head -n 4                                   
commit e4ec7b275ada47ca32799106c2dba142d96aaf93
Author: Lomanic <Lomanic@users.noreply.github.com>
Date:   1567336284

My immediate assumption was that this was TAI vs. UTC, but apparently that gap is currently 37 seconds, and the difference between the two Git timestamps is 49 seconds, so...???

@hyangah

This comment has been minimized.

Copy link
Contributor

@hyangah hyangah commented Sep 19, 2019

It seems one is author date, another is committer date.

$ git -c log.showsignature=false log -n1 '--format=format:%H ct:%ct at:%at' e4ec7b275ada
e4ec7b275ada47ca32799106c2dba142d96aaf93 ct:1567336333 at:1567336284
@hyangah hyangah changed the title go mod: determined pseudo-version timestamp differs from the commit timestamp by a couple seconds cmd/go: determined pseudo-version timestamp differs from the commit timestamp by a couple seconds Sep 19, 2019
@hyangah

This comment has been minimized.

Copy link
Contributor

@hyangah hyangah commented Sep 19, 2019

Committer date is suitable for this use. So, working as intended.

@hyangah hyangah closed this Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.