Skip to content

Commit 10f09ea

Browse files
committed
Update main.go
1 parent dc53d78 commit 10f09ea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/slackMessageParser/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package main
99
import (
1010
"encoding/json"
1111
"fmt"
12+
"log"
1213
"os"
1314
"path/filepath"
1415
"strconv"
@@ -75,7 +76,11 @@ type CSVRecord struct {
7576
func main() {
7677
files, err := filepath.Glob("../../SlackMessages/*.json")
7778
if err != nil {
78-
fmt.Println(err)
79+
log.Fatal(err)
80+
}
81+
82+
if len(files) == 0 {
83+
log.Fatal("Could not find *.json files in the ./SlackMessages directory")
7984
}
8085

8186
messages := make([]*Message, 0)
@@ -149,7 +154,7 @@ func main() {
149154

150155
csvFile, err := os.Create("../../slack_records.csv")
151156
if err != nil {
152-
fmt.Println(err)
157+
log.Fatal(err)
153158
}
154159
defer csvFile.Close()
155160

0 commit comments

Comments
 (0)