pkg/tsdb/stackdriver/stackdriver.go: Fix regular expression does not contain any meta characters.

See,
$ gometalinter --vendor --deadline 10m --disable-all --enable=megacheck ./...
pkg/tsdb/stackdriver/stackdriver.go:171:26⚠️ regular expression does not contain any meta characters (SA6004) (megacheck)
This commit is contained in:
Mario Trangoni 2018-10-19 19:47:31 +02:00
parent bb12a1bc99
commit 91447dcbf9

View File

@ -168,8 +168,7 @@ func reverse(s string) string {
}
func interpolateFilterWildcards(value string) string {
re := regexp.MustCompile("[*]")
matches := len(re.FindAllStringIndex(value, -1))
matches := strings.Count(value, "*")
if matches == 2 && strings.HasSuffix(value, "*") && strings.HasPrefix(value, "*") {
value = strings.Replace(value, "*", "", -1)
value = fmt.Sprintf(`has_substring("%s")`, value)