【发布时间】:2017-10-17 02:12:00
【问题描述】:
我正在使用github.com/fatih/structs 包通过toValues() 函数将结构的所有字段的值转换为[]interface{}。见here。这工作正常,但最终我想通过使用 csv 包将值写入 csv 文件。 csv.Write() 函数需要 []string 作为输入。
简而言之:如何轻松地将toValues() 的输出转换为字符串数组?
【问题讨论】:
标签: string go struct interface slice