From 00eafa65270024ca4c9ae5d85529091cb586b695 Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Thu, 10 Sep 2015 15:07:14 +0900 Subject: [PATCH] check len s before assigning loc for gocyclo --- check/utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/check/utils.go b/check/utils.go index cf2cfd9..3a17b36 100644 --- a/check/utils.go +++ b/check/utils.go @@ -95,7 +95,9 @@ func getFileSummary(filename, dir, cmd, out string) (FileSummary, error) { var loc string if cmd == "gocyclo" { s := strings.SplitN(sp, " ", 2) - loc = s[1] + if len(s) > 1 { + loc = s[1] + } } else { s := strings.SplitN(sp, ": ", 2) loc = s[0]