diff --git a/cmd/check.go b/cmd/check.go index 0cb4f32..eb3d2c9 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -124,8 +124,8 @@ func PrintKnockEvents(events []KnockEvent) { func eventsFromEventsFile() []Event { configFolder := ereConfigFolder() eventsFile := filepath.Join(configFolder, ereEventsFileName) - _, err := os.Stat(eventsFile) events := make([]Event, 0) + _, err := os.Stat(eventsFile) if errors.Is(err, os.ErrNotExist) { _, err := os.Create(eventsFile) if err != nil { @@ -139,6 +139,9 @@ func eventsFromEventsFile() []Event { log.Fatal(err) } bytes, err := io.ReadAll(jsonFile) + if len(bytes) == 0 { + return events + } if err != nil { log.Fatal(err) }