From c7185d7e9d21426e2cc82a66ece9aac265f7d00e Mon Sep 17 00:00:00 2001 From: gprggr Date: Tue, 30 Dec 2014 21:58:49 +0100 Subject: [PATCH] pkg/proc: moving defer after error check --- pkg/proc/proc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/proc/proc.go b/pkg/proc/proc.go index 0dfbd3f..3181f58 100644 --- a/pkg/proc/proc.go +++ b/pkg/proc/proc.go @@ -128,10 +128,10 @@ func LiveProcs(prefix string) (map[int][]string, error) { // sockets open on the system accessing any paths with the given prefix func unixSocketsWithPrefix(pre string) (map[string]string, error) { fh, err := os.Open(unixSocks) - defer fh.Close() if err != nil { return nil, err } + defer fh.Close() socks := make(map[string]string) scanner := bufio.NewScanner(fh) for scanner.Scan() {