Skip to content

Commit 65d3aa9

Browse files
committed
cmd/go/internal: optimize code with newly defined time.DateTime constants
Signed-off-by: cui fliter <[email protected]>
1 parent 2551324 commit 65d3aa9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cmd/go/internal/modfetch/codehost/vcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ func fossilParseStat(rev, out string) (*RevInfo, error) {
587587
if len(f) != 5 || len(f[1]) != 40 || f[4] != "UTC" {
588588
return nil, vcsErrorf("unexpected response from fossil info: %q", line)
589589
}
590-
t, err := time.Parse("2006-01-02 15:04:05", f[2]+" "+f[3])
590+
t, err := time.Parse(time.DateTime, f[2]+" "+f[3])
591591
if err != nil {
592592
return nil, vcsErrorf("unexpected response from fossil info: %q", line)
593593
}

src/cmd/go/internal/vcs/vcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ func fossilStatus(vcsFossil *Cmd, rootDir string) (Status, error) {
561561
}
562562
rev := checkout[:i]
563563

564-
commitTime, err := time.ParseInLocation("2006-01-02 15:04:05", checkout[i+1:], time.UTC)
564+
commitTime, err := time.ParseInLocation(time.DateTime, checkout[i+1:], time.UTC)
565565
if err != nil {
566566
return Status{}, fmt.Errorf("%v: %v", errFossilInfo, err)
567567
}

0 commit comments

Comments
 (0)