Skip to content

Commit

Permalink
Use slices
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Aug 26, 2024
1 parent 1f24d02 commit 3944aaf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 2 additions & 1 deletion cli/packages/cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/hex"
"encoding/json"
"os"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -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)

Expand Down
9 changes: 0 additions & 9 deletions cli/packages/util/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 3944aaf

Please sign in to comment.