From f740ffba62b66ba2a5c7bd250b462f227bdc90e5 Mon Sep 17 00:00:00 2001 From: ArrisLee Date: Fri, 29 Mar 2019 16:54:44 +1300 Subject: [PATCH] A bit impovement maybe? --- 23_error-handling/02_err-not-nil/01_fmt-println/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/23_error-handling/02_err-not-nil/01_fmt-println/main.go b/23_error-handling/02_err-not-nil/01_fmt-println/main.go index e076b8a5..83a3d616 100644 --- a/23_error-handling/02_err-not-nil/01_fmt-println/main.go +++ b/23_error-handling/02_err-not-nil/01_fmt-println/main.go @@ -6,8 +6,7 @@ import ( ) func main() { - _, err := os.Open("no-file.txt") - if err != nil { + if _, err := os.Open("no-file.txt"); err != nil { fmt.Println("err happened", err) // log.Println("err happened", err) // log.Fatalln(err)