always trim space around each cell in the csv file

This commit is contained in:
Steven Polley 2020-05-29 20:19:13 -06:00
parent dba0fd14c5
commit 47c64f6106

View File

@ -51,7 +51,7 @@ func main() {
}
// Create a new instance of type Redirect and populate with data from CSV file
redirect := Redirect{sourceURL: row[0], destinationURL: row[1]}
redirect := Redirect{sourceURL: strings.TrimSpace(row[0]), destinationURL: strings.TrimSpace(row[1])}
redirect.statusCode, err = strconv.Atoi(strings.TrimSpace(row[2]))
if err != nil {
log.Printf("skipping row: failed to convert status code '%s' to integer: %v", row[2], err)