always trim space around each cell in the csv file
This commit is contained in:
parent
dba0fd14c5
commit
47c64f6106
2
main.go
2
main.go
@ -51,7 +51,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a new instance of type Redirect and populate with data from CSV file
|
// 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]))
|
redirect.statusCode, err = strconv.Atoi(strings.TrimSpace(row[2]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("skipping row: failed to convert status code '%s' to integer: %v", row[2], err)
|
log.Printf("skipping row: failed to convert status code '%s' to integer: %v", row[2], err)
|
||||||
|
Loading…
Reference in New Issue
Block a user