fix: format dates in log in a portable way (#735)

The output of time.String() depends on the runtime environment and should only be used for debugging.

This commit ensures that a well-defined UTC time is written to the report.
This commit is contained in:
Florian Greinacher authored and GitHub committed 2021-12-03 09:34:57 -06:00
1 parent 98d5648f6e
commit 106897fdf0
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -3,6 +3,7 @@ package detect
import (
"strings"
"sync"
"time"
"github.com/gitleaks/go-gitdiff/gitdiff"
"github.com/rs/zerolog/log"
@@ -70,7 +71,7 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
fi.Author = f.PatchHeader.Author.Name
fi.Email = f.PatchHeader.Author.Email
}
fi.Date = f.PatchHeader.AuthorDate.String()
fi.Date = f.PatchHeader.AuthorDate.UTC().Format(time.RFC3339)
}
if outputOptions.Redact {