cmd/go/internal: use time.DateTime constant

Use the newly defined time.Datetime constant instead of a string literal.

Updates #52746

Change-Id: I2722415ecc67fd2adfdab2eaba3298774032bff3
GitHub-Last-Rev: 65d3aa9bc2
GitHub-Pull-Request: golang/go#55833
Reviewed-on: https://go-review.googlesource.com/c/go/+/433277
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
cui fliter 2022-09-23 21:29:44 +00:00 committed by Gopher Robot
parent e6d9057e2f
commit f6e1677428
2 changed files with 2 additions and 2 deletions

View File

@ -587,7 +587,7 @@ func fossilParseStat(rev, out string) (*RevInfo, error) {
if len(f) != 5 || len(f[1]) != 40 || f[4] != "UTC" {
return nil, vcsErrorf("unexpected response from fossil info: %q", line)
}
t, err := time.Parse("2006-01-02 15:04:05", f[2]+" "+f[3])
t, err := time.Parse(time.DateTime, f[2]+" "+f[3])
if err != nil {
return nil, vcsErrorf("unexpected response from fossil info: %q", line)
}

View File

@ -561,7 +561,7 @@ func fossilStatus(vcsFossil *Cmd, rootDir string) (Status, error) {
}
rev := checkout[:i]
commitTime, err := time.ParseInLocation("2006-01-02 15:04:05", checkout[i+1:], time.UTC)
commitTime, err := time.ParseInLocation(time.DateTime, checkout[i+1:], time.UTC)
if err != nil {
return Status{}, fmt.Errorf("%v: %v", errFossilInfo, err)
}