From cefdf398571c4d134f433b494de986191d240034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 3 Jul 2015 22:51:32 -0700 Subject: [PATCH] Checking for the length of submatches isn't necessary --- adb/adb.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/adb/adb.go b/adb/adb.go index 11a997f..8c6d659 100644 --- a/adb/adb.go +++ b/adb/adb.go @@ -145,11 +145,7 @@ func (d *Device) AdbShell(args ...string) *exec.Cmd { } func getFailureCode(r *regexp.Regexp, line string) string { - s := r.FindStringSubmatch(line) - if len(s) < 2 { - return "" - } - return s[1] + return r.FindStringSubmatch(line)[1] } var installFailureRegex = regexp.MustCompile(`^Failure \[INSTALL_(.+)\]$`)