Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Use slices

Daniel Hougaard3944aafb11f3
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
-}