chore: use slices.Contains for linear search

This commit is contained in:
Claude 2026-02-24 15:43:09 +00:00
parent e3c2315c6a
commit 02a27dde71
No known key found for this signature in database
GPG key ID: AF404715446AEB41
2 changed files with 7 additions and 16 deletions

View file

@ -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

View file

@ -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)
}
}