Use slices

This commit is contained in:
Daniel Hougaard
2024-08-26 15:18:45 +04:00
parent 1f24d02c5e
commit 3944aafb11
2 changed files with 2 additions and 10 deletions

View File

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

View File

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