mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-08-08 15:44:38 +00:00
log-parser: Use time.IsZero() to check
Using time.IsZero() to check for uninitialised times is clearer Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
@@ -129,7 +129,7 @@ func (le LogEntry) Check(ignoreMissingFields bool) error {
|
||||
return fmt.Errorf("missing line number: %+v", le)
|
||||
}
|
||||
|
||||
if le.Time == (time.Time{}) {
|
||||
if le.Time.IsZero() {
|
||||
return fmt.Errorf("missing timestamp: %+v", le)
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ func TestParseTime(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, d := range data {
|
||||
if d.timeString != "" && d.t == (time.Time{}) {
|
||||
if d.timeString != "" && d.t.IsZero() {
|
||||
t, err := time.Parse(time.RFC3339Nano, d.timeString)
|
||||
assert.NoError(err)
|
||||
d.t = t
|
||||
|
||||
Reference in New Issue
Block a user