cmd/go/internal: optimize code with newly defined time.DateTime constants

Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
cui fliter 2022-09-23 17:35:27 +08:00
parent 2551324cd0
commit 65d3aa9bc2
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)
}