From 12d25a45c229d28e7716b2a3c3d4d13a7dcfb1db Mon Sep 17 00:00:00 2001 From: lotusirous <5105237+lotusirous@users.noreply.github.com> Date: Mon, 13 Dec 2021 23:30:48 +0900 Subject: [PATCH] Remove exit function --- main.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 7d781d8..dac24b8 100644 --- a/main.go +++ b/main.go @@ -78,11 +78,6 @@ func usage() { os.Exit(2) } -func exit(w io.Writer, a ...interface{}) { - fmt.Fprintln(w, a...) - os.Exit(1) -} - var ( verbose = flag.Bool("v", false, `print the file hash in (md5, sha1, sha256)`) ) @@ -99,7 +94,8 @@ func main() { abs, fi, err := ReadFileInfo(path) if err != nil { - exit(fd, "Cannot resolve the path: ", err) + fmt.Fprintln(fd, "Cannot resolve the path: ", err) + os.Exit(1) } fmt.Fprintf(fd, "PATH: %s\n", abs)