fix: adjust yaml config decodification to yaml.v3 (#5722)

This commit is contained in:
Ariel Leyva
2026-01-31 01:35:47 -05:00
committed by GitHub
parent 1053aace8c
commit b594d4d4e2
2 changed files with 1 additions and 35 deletions

View File

@@ -3,7 +3,6 @@ package cmd
import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"log"
"os"
@@ -249,33 +248,6 @@ func jsonYamlArg(cmd *cobra.Command, args []string) error {
}
}
func cleanUpInterfaceMap(in map[interface{}]interface{}) map[string]interface{} {
result := make(map[string]interface{})
for k, v := range in {
result[fmt.Sprintf("%v", k)] = cleanUpMapValue(v)
}
return result
}
func cleanUpInterfaceArray(in []interface{}) []interface{} {
result := make([]interface{}, len(in))
for i, v := range in {
result[i] = cleanUpMapValue(v)
}
return result
}
func cleanUpMapValue(v interface{}) interface{} {
switch v := v.(type) {
case []interface{}:
return cleanUpInterfaceArray(v)
case map[interface{}]interface{}:
return cleanUpInterfaceMap(v)
default:
return v
}
}
// convertCmdStrToCmdArray checks if cmd string is blank (whitespace included)
// then returns empty string array, else returns the split word array of cmd.
// This is to ensure the result will never be []string{""}