From dc618aa730bab7b83d0a74e825e9c1028f4bcfb9 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Tue, 3 Oct 2023 17:36:58 +0200 Subject: [PATCH] [publisher] Use slices contains --- publisher/main.go | 3 ++- publisher/utils.go | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/publisher/main.go b/publisher/main.go index 4d4a2c8..f3411c5 100644 --- a/publisher/main.go +++ b/publisher/main.go @@ -5,6 +5,7 @@ import ( "log" "os" "path/filepath" + "slices" ) func main() { @@ -42,7 +43,7 @@ func iterDirectories(baseDir string, addons []string) error { if !dir.IsDir() { continue } - if len(addons) != 0 && !contains(addons, dir.Name()) { + if len(addons) != 0 && !slices.Contains(addons, dir.Name()) { continue } addonCfg := newAddonConfig(dir.Name(), baseDir) diff --git a/publisher/utils.go b/publisher/utils.go index 4009a89..1db78e0 100644 --- a/publisher/utils.go +++ b/publisher/utils.go @@ -34,12 +34,3 @@ func zipFile(zw *zip.Writer, src string, dest string) error { _, err = io.Copy(zf, file) return err } - -func contains[T comparable](elems []T, v T) bool { - for _, s := range elems { - if v == s { - return true - } - } - return false -}