Unmarshal CSV record into struct in Go
There is gocarina/gocsv which handles custom struct in the same way encoding/json does. You can also write custom marshaller and unmarshaller for specific types. Example: type Client struct { Id string `csv:”client_id”` // .csv column headers Name string `csv:”client_name”` Age string `csv:”client_age”` } func main() { in, err := os.Open(“clients.csv”) if err != nil { … Read more