From 335f63a282caf0a0cad012fca580ff0414def482 Mon Sep 17 00:00:00 2001 From: Rajasekaran Date: Sun, 6 Mar 2016 09:22:26 +0530 Subject: [PATCH] Handling error condition in loadspec Signed-off-by: Rajasekaran --- spec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.go b/spec.go index 9c9146d31..6c497aa25 100644 --- a/spec.go +++ b/spec.go @@ -220,12 +220,12 @@ func loadSpec(cPath string) (spec *specs.LinuxSpec, err error) { if os.IsNotExist(err) { return nil, fmt.Errorf("JSON specification file %s not found", cPath) } - return spec, err + return nil, err } defer cf.Close() if err = json.NewDecoder(cf).Decode(&spec); err != nil { - return spec, err + return nil, err } return spec, validateSpec(spec) }