From a7e6848e8f2121c48c095a012370644ef5f810b9 Mon Sep 17 00:00:00 2001 From: Sergey Lanzman Date: Thu, 21 Dec 2017 20:44:53 +0200 Subject: [PATCH] check error after load --- safesql.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/safesql.go b/safesql.go index f26d65c..adf8bb8 100644 --- a/safesql.go +++ b/safesql.go @@ -65,6 +65,11 @@ func main() { } p, err := c.Load() + if err != nil { + fmt.Printf("error loading packages %v: %v\n", pkgs, err) + os.Exit(2) + } + imports := getImports(p) existOne := false for i := range sqlPackages { @@ -81,11 +86,6 @@ func main() { os.Exit(2) } - if err != nil { - fmt.Printf("error loading packages %v: %v\n", pkgs, err) - os.Exit(2) - } - s := ssautil.CreateProgram(p, 0) s.Build()