Apply go fix -slicescontains ./...

This commit is contained in:
Michael Eischer
2026-07-22 22:26:33 +02:00
parent e2495b72bb
commit a2cb015591
5 changed files with 12 additions and 38 deletions
+3 -13
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"os/user"
"path/filepath"
"slices"
"sync"
"time"
@@ -174,12 +175,7 @@ func (sn *Snapshot) RemoveTags(removeTags []string) (changed bool) {
}
func (sn *Snapshot) hasTag(tag string) bool {
for _, snTag := range sn.Tags {
if tag == snTag {
return true
}
}
return false
return slices.Contains(sn.Tags, tag)
}
// HasTags returns true if the snapshot has all the tags in l.
@@ -240,13 +236,7 @@ func (sn *Snapshot) HasHostname(hostnames []string) bool {
return true
}
for _, hostname := range hostnames {
if sn.Hostname == hostname {
return true
}
}
return false
return slices.Contains(hostnames, sn.Hostname)
}
// Snapshots is a list of snapshots.