From 02a27dde71a20165940b60db0b1d101c013e7bf0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 15:43:09 +0000 Subject: [PATCH] chore: use slices.Contains for linear search --- ansible/executor.go | 13 +++++-------- release/changelog.go | 10 ++-------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ansible/executor.go b/ansible/executor.go index 08ea851..54a82ba 100644 --- a/ansible/executor.go +++ b/ansible/executor.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "regexp" + "slices" "strings" "sync" "text/template" @@ -920,20 +921,16 @@ func (e *Executor) matchesTags(taskTags []string) bool { // Check skip tags for _, skip := range e.SkipTags { - for _, tt := range taskTags { - if skip == tt { - return false - } + if slices.Contains(taskTags, skip) { + return false } } // Check include tags if len(e.Tags) > 0 { for _, tag := range e.Tags { - for _, tt := range taskTags { - if tag == tt || tag == "all" { - return true - } + if tag == "all" || slices.Contains(taskTags, tag) { + return true } } return false diff --git a/release/changelog.go b/release/changelog.go index c25fc52..ba74eb4 100644 --- a/release/changelog.go +++ b/release/changelog.go @@ -7,6 +7,7 @@ import ( "fmt" "os/exec" "regexp" + "slices" "sort" "strings" @@ -269,14 +270,7 @@ func formatChangelog(commits []ConventionalCommit, version string) string { // Any remaining types not in the order list var remainingTypes []string for commitType := range grouped { - found := false - for _, t := range commitTypeOrder { - if t == commitType { - found = true - break - } - } - if !found { + if !slices.Contains(commitTypeOrder, commitType) { remainingTypes = append(remainingTypes, commitType) } }