// readCsv Reads a CSV file, assuming first line is header row, returning a list of map[string]string objects
readCsv Reads a CSV file, assuming first line is header row, returning a list of map[string]string objects
// readCsv Reads a CSV file assuming first line is header row returning a list of map [ string ] string objects
func readCsv(file string) []map[string]string {
	input, err := os.Open(file)
	util.ExitIfError(err, fmt.Sprintf("Error opening file %s", file))
	r := csv.NewReader(input)
	var headers []string
	first := true
	var all []map[string]string
	for {
		record, err := r.Read()
		if err == io.EOF {
			break
		}
		util.ExitIfError(err, fmt.Sprintf("Error processing csv file %s: %s", file, err))
		if first {
			headers = record
			first = false
		} else {
			all = append(all, toMap(headers, record))
		}
	}
	return all
}
func readCsv ( file string ) [ ] map [ string ] string { input , err := os . Open ( file ) util . ExitIfError ( err , fmt . Sprintf ( " " , file ) ) r := csv . NewReader ( input ) var headers [ ] string first := true var all [ ] map [ string ] string for { record , err := r . Read ( ) if err == io . EOF { break } util . ExitIfError ( err , fmt . Sprintf ( " " , file , err ) ) if first { headers = record first = false } else { all = append ( all , toMap ( headers , record ) ) } } return all }
readCsv Reads a CSV file, assuming first line is header row, returning a list of map[string]string objects
readCsv Reads a CSV file assuming first line is header row returning a list of map [ string ] string objects