From a37027f6bdcb2f035fcccd99c6c6064934623a04 Mon Sep 17 00:00:00 2001 From: Elena Morozova Date: Thu, 13 Oct 2016 14:18:43 -0700 Subject: [PATCH] all: use strings.Contains instead Index Signed-off-by: Elena Morozova --- pkg/fileutils/fileutils.go | 2 +- runconfig/opts/parse.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/fileutils/fileutils.go b/pkg/fileutils/fileutils.go index c00a0cdee3..c63ae75ce8 100644 --- a/pkg/fileutils/fileutils.go +++ b/pkg/fileutils/fileutils.go @@ -180,7 +180,7 @@ func regexpMatch(pattern, path string) (bool, error) { } else if ch == '?' { // "?" is any char except "/" regStr += "[^" + escSL + "]" - } else if strings.Index(".$", string(ch)) != -1 { + } else if ch == '.' || ch == '$' { // Escape some regexp special chars that have no meaning // in golang's filepath.Match regStr += `\` + string(ch) diff --git a/runconfig/opts/parse.go b/runconfig/opts/parse.go index b7097c3ec8..5b99ce6736 100644 --- a/runconfig/opts/parse.go +++ b/runconfig/opts/parse.go @@ -697,7 +697,7 @@ func parseSecurityOpts(securityOpts []string) ([]string, error) { for key, opt := range securityOpts { con := strings.SplitN(opt, "=", 2) if len(con) == 1 && con[0] != "no-new-privileges" { - if strings.Index(opt, ":") != -1 { + if strings.Contains(opt, ":") { con = strings.SplitN(opt, ":", 2) } else { return securityOpts, fmt.Errorf("Invalid --security-opt: %q", opt)