Chore: Use standard lib

This commit is contained in:
Daniel Hougaard
2024-04-22 19:50:24 +02:00
parent 973ed37018
commit 519d6f98a2

View File

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