From 10c06deff2b9b8b6694b944330cfad54b06d2626 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 11 Jun 2020 17:23:12 +0100 Subject: [PATCH] Replaced log.Errorf with log.Fatalf Logger.Fatalf calls the os.Exit(1) for you --- lokalize2android.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lokalize2android.go b/lokalize2android.go index 90882a9..2f65a3c 100755 --- a/lokalize2android.go +++ b/lokalize2android.go @@ -131,8 +131,7 @@ func main() { if len(os.Args) == 2 { f, err := os.Open(os.Args[1]) if err != nil { - log.Errorf("error reading file: %q", err) - os.Exit(1) + log.Fatalf("error reading file: %q", err) } r = f } else { @@ -141,14 +140,12 @@ func main() { var rs Resources if err := json.NewDecoder(r).Decode(&rs); err != nil { - log.Errorf("error parsing json: %q", err) - os.Exit(1) + log.Fatalf("error parsing json: %q", err) } b, err := xml.MarshalIndent(rs, "", "\t") if err != nil { - log.Errorf("error serializing xml: %q", err) - os.Exit(1) + log.Fatalf("error serializing xml: %q", err) } fmt.Println(string(b)) }