Skip to content

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

Chore: Use standard lib

Daniel Hougaard519d6f98a246
diff --git a/cli/packages/util/helper.go b/cli/packages/util/helper.go
index 5ffe5c9f1b..9a4d960db8 100644
--- a/cli/packages/util/helper.go
+++ b/cli/packages/util/helper.go
@@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"path"
+ "sort"
"strings"
"time"
@@ -55,14 +56,9 @@ func GetBase64DecodedSymmetricEncryptionDetails(key string, cipher string, IV st
// Helper function to sort the secrets by key so we can create a consistent output
func SortSecretsByKeys(secrets []models.SingleEnvironmentVariable) []models.SingleEnvironmentVariable {
- for i := 0; i < len(secrets); i++ {
- for j := i + 1; j < len(secrets); j++ {
- if secrets[i].Key > secrets[j].Key {
- secrets[i], secrets[j] = secrets[j], secrets[i]
- }
- }
- }
-
+ sort.Slice(secrets, func(i, j int) bool {
+ return secrets[i].Key < secrets[j].Key
+ })
return secrets
}