From 3e4b4eec7884abb382c2eb87a705eacfdbb3a932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Thu, 7 May 2026 10:31:10 +0400 Subject: [PATCH] Go fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/cookiebanner/worker.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/cookiebanner/worker.go b/pkg/cookiebanner/worker.go index a3f072479..fac4b519f 100644 --- a/pkg/cookiebanner/worker.go +++ b/pkg/cookiebanner/worker.go @@ -322,22 +322,22 @@ func templateCandidates(name string) []string { } func splitTokens(name string) ([]string, byte) { - if idx := strings.IndexByte(name, '_'); idx >= 0 { + if found := strings.Contains(name, "_"); found { return strings.Split(name, "_"), '_' } - if idx := strings.IndexByte(name, '-'); idx >= 0 { + if found := strings.Contains(name, "-"); found { return strings.Split(name, "-"), '-' } return []string{name}, 0 } func globMatch(pattern, name string) bool { - star := strings.Index(pattern, "*") - if star < 0 { + before, after, ok := strings.Cut(pattern, "*") + if !ok { return pattern == name } - prefix := pattern[:star] - suffix := pattern[star+1:] + prefix := before + suffix := after return strings.HasPrefix(name, prefix) && strings.HasSuffix(name, suffix) && len(name) >= len(prefix)+len(suffix)