Replaced log.Errorf with log.Fatalf
Logger.Fatalf calls the os.Exit(1) for you
This commit is contained in:
parent
04ad9c78f5
commit
10c06deff2
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue