diff --git a/main.go b/main.go index f335b5d..c9b76ec 100644 --- a/main.go +++ b/main.go @@ -328,20 +328,22 @@ func main() { // Load the JSON data from file file, err := os.Open(*inputFile) if err != nil { - log.Fatalf("Failed to open input.json: %v", err) + fmt.Printf("Failed to open input.json: %v", err) + os.Exit(1) } defer file.Close() byteValue, err := io.ReadAll(file) if err != nil { - log.Fatalf("Failed to read input json: %v", err) + fmt.Printf("Failed to read input json: %v", err) + os.Exit(1) } // Detect encoding and convert to UTF-8 if necessary utf8Data, err := ensureUTF8(byteValue) if err != nil { fmt.Printf("Error ensuring UTF-8 encoding: %v\n", err) - return + os.Exit(1) } if err := json.Unmarshal(utf8Data, &data); err != nil { @@ -360,6 +362,8 @@ func main() { fmt.Printf("Error saving excel workbook: %s\n", err) os.Exit(1) } + + os.Exit(0) } // parseDate parses a date string like "January-2006" into a time.Time object