示例来源:
// source multidimensional slice
var source = []interface{}{
"value1",
"value2",
1234,
1234.1234,
[]int{222, 333},
[]float32{444.444, 555.555},
[]interface{}{555, "value4", []int{777, 888}}
}
目标:
// target []string
var target = []string{
"value1",
"value2",
"1234",
"1234.1234",
"222",
"333",
"444.444",
"555.555",
"555",
"value4",
"777",
"888"
}
我写了转换函数。但这在我看来很麻烦,并且没有涵盖所有可能的选择。你能告诉我可以有更优雅的决定吗?
慕标5832272
相关分类