From 6a26cc6b113cc22724de2d91f0ddd01844460367 Mon Sep 17 00:00:00 2001 From: Sam Broughton Date: Mon, 6 Jun 2016 10:51:41 +0100 Subject: [PATCH] Use if/else instead of os.Exit(0) --- cmd/tomll/main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/tomll/main.go b/cmd/tomll/main.go index ae16f299..fdc6825c 100644 --- a/cmd/tomll/main.go +++ b/cmd/tomll/main.go @@ -19,16 +19,16 @@ func main() { os.Exit(-1) } io.WriteString(os.Stdout, s) - os.Exit(0) - } - // otherwise modify a list of files - for _, filename := range flag.Args() { - s, err := lintFile(filename) - if err != nil { - io.WriteString(os.Stderr, err.Error()) - os.Exit(-1) + } else { + // otherwise modify a list of files + for _, filename := range flag.Args() { + s, err := lintFile(filename) + if err != nil { + io.WriteString(os.Stderr, err.Error()) + os.Exit(-1) + } + ioutil.WriteFile(filename, []byte(s), 0644) } - ioutil.WriteFile(filename, []byte(s), 0644) } }