Browse code

all: use strings.Contains instead Index

Signed-off-by: Elena Morozova <lelenanam@gmail.com>

Elena Morozova authored on 2016/10/14 06:18:43
Showing 2 changed files
... ...
@@ -180,7 +180,7 @@ func regexpMatch(pattern, path string) (bool, error) {
180 180
 		} else if ch == '?' {
181 181
 			// "?" is any char except "/"
182 182
 			regStr += "[^" + escSL + "]"
183
-		} else if strings.Index(".$", string(ch)) != -1 {
183
+		} else if ch == '.' || ch == '$' {
184 184
 			// Escape some regexp special chars that have no meaning
185 185
 			// in golang's filepath.Match
186 186
 			regStr += `\` + string(ch)
... ...
@@ -697,7 +697,7 @@ func parseSecurityOpts(securityOpts []string) ([]string, error) {
697 697
 	for key, opt := range securityOpts {
698 698
 		con := strings.SplitN(opt, "=", 2)
699 699
 		if len(con) == 1 && con[0] != "no-new-privileges" {
700
-			if strings.Index(opt, ":") != -1 {
700
+			if strings.Contains(opt, ":") {
701 701
 				con = strings.SplitN(opt, ":", 2)
702 702
 			} else {
703 703
 				return securityOpts, fmt.Errorf("Invalid --security-opt: %q", opt)