update logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-12-02 08:41:20 +11:00
parent 5886175f8a
commit 24127787b1

10
main.go
View File

@@ -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