From 3944aafb11f303ce37c6dc10c763ff55a740f7ef Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 26 Aug 2024 15:18:45 +0400 Subject: [PATCH] Use slices --- cli/packages/cmd/login.go | 3 ++- cli/packages/util/helper.go | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/cli/packages/cmd/login.go b/cli/packages/cmd/login.go index 51b464b1fa..f661975172 100644 --- a/cli/packages/cmd/login.go +++ b/cli/packages/cmd/login.go @@ -8,6 +8,7 @@ import ( "encoding/hex" "encoding/json" "os" + "slices" "strings" "time" @@ -605,7 +606,7 @@ func askForDomain() error { // Write the new domain to the config file, to allow the user to select it in the future if needed // First check if infiscialConfig.Domains already includes the domain, if it does, do not add it again - if !util.ArrayContains(infisicalConfig.Domains, domain) { + if !slices.Contains(infisicalConfig.Domains, domain) { infisicalConfig.Domains = append(infisicalConfig.Domains, domain) err = util.WriteConfigFile(&infisicalConfig) diff --git a/cli/packages/util/helper.go b/cli/packages/util/helper.go index 7b4e788064..69a310efae 100644 --- a/cli/packages/util/helper.go +++ b/cli/packages/util/helper.go @@ -298,12 +298,3 @@ func GenerateRandomString(length int) string { } return string(b) } - -func ArrayContains(arr []string, val string) bool { - for _, item := range arr { - if item == val { - return true - } - } - return false -}