diff --git a/cmd/config_import.go b/cmd/config_import.go index 9a838721..8019bbb8 100644 --- a/cmd/config_import.go +++ b/cmd/config_import.go @@ -3,7 +3,6 @@ package cmd import ( "encoding/json" "errors" - "path/filepath" "reflect" "github.com/spf13/cobra" @@ -68,12 +67,7 @@ The path must be for a json or yaml file.`, return err } - var rawAuther interface{} - if filepath.Ext(args[0]) != ".json" { - rawAuther = cleanUpInterfaceMap(file.Auther.(map[interface{}]interface{})) - } else { - rawAuther = file.Auther - } + var rawAuther = file.Auther var auther auth.Auther var autherErr error diff --git a/cmd/utils.go b/cmd/utils.go index ee637fa3..a57856e4 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -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{""}