I'm trying to write a CSV file using the package encoding/csv
. All data I want to write per line is saved in a struct like this:
type record struct {
Field0 string
Field1 string
Field2 string
Field3 string
}
The csv package has a method called Write that requires a slice of strings.
Is it possible to convert a struct to a slice of strings?