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

x/vgo: go.mod: For git, date in pseudo-version should be AuthorDate instead of CommitDate #23973

Closed
holygeek opened this issue Feb 21, 2018 · 2 comments
Milestone

Comments

@holygeek
Copy link

Mainly because git log, by default, shows only the AuthorDate. This is so that it will be easier for a human to verify that the date specified in go.mod matches the date shown in plain git log, barring timezone differences. Otherwise you have to run git log with --format=fuller in order to show CommitDate so that you can tally it with the one in go.mod.

$ cat go.mod
module "rsc.io/sampler"

require "golang.org/x/text" v0.0.0-20170915032832-14c0d48ead0c

See how the date shown below could seem to not match what is recorded in go.mod (superficially the time looks different, which could raise an eyebrow or two):

$ cd $GOPATH/src/golang.org/x/text
$ git log -1 --date=iso 14c0d48ead0c                
commit 14c0d48ead0cd47e3104ada247d91be04afc7a5a
Author: namusyaka <namusyaka@gmail.com>
Date:   2017-09-15 10:46:53 +0900

    docs: fix article typos
    
    a -> an
    
    Change-Id: Ia55603f09303598a1b0051606e83f018b3525c24
    Reviewed-on: https://go-review.googlesource.com/63993
    Reviewed-by: Ian Lance Taylor <iant@golang.org>

You'd have know that git commit has two associated dates (author date and commit date) in order to not be confused by the date specified in go.mod:

$ git log -1 --format=fuller --date=iso 14c0d48ead0c
commit 14c0d48ead0cd47e3104ada247d91be04afc7a5a
Author:     namusyaka <namusyaka@gmail.com>
AuthorDate: 2017-09-15 10:46:53 +0900
Commit:     Ian Lance Taylor <iant@golang.org>
CommitDate: 2017-09-15 03:28:32 +0000

    docs: fix article typos
    
    a -> an
    
    Change-Id: Ia55603f09303598a1b0051606e83f018b3525c24
    Reviewed-on: https://go-review.googlesource.com/63993
    Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot gopherbot added this to the Unreleased milestone Feb 21, 2018
@dsnet dsnet modified the milestones: Unreleased, vgo Feb 21, 2018
@mpx
Copy link
Contributor

mpx commented Feb 21, 2018

Including the date in a version makes it easier to understand if one version is newer than another (especially for untagged commits). Using the AuthorDate would remove this important property.

The commit ID a much better way to identify the commit in use.

@rsc
Copy link
Contributor

rsc commented Feb 22, 2018

The commit date is the date it landed in the public repo. That's the last time it was revised, which is what matters for approximate ordering. The date it was first written is much less relevant.

@rsc rsc closed this as completed Feb 22, 2018
@golang golang locked and limited conversation to collaborators Feb 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants