Make cross-configuration validation deterministic

This commit is contained in:
2026-09-05 03:37:00 +00:00
parent 0d4d71b9dc
commit 5b62a8d60d
5 changed files with 35 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"path/filepath"
"regexp"
"sort"
"strings"
"time"
)
@@ -11,6 +12,15 @@ import (
var windowsAbsPathRE = regexp.MustCompile(`^[A-Za-z]:[\\/].*`)
var envVarNameRE = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
func sortedStringKeys[V any](values map[string]V) []string {
keys := make([]string, 0, len(values))
for key := range values {
keys = append(keys, key)
}
sort.Strings(keys)
return keys
}
func validateEnvVarNameField(fieldName, value string) error {
trimmed := strings.TrimSpace(value)
if trimmed == "" {