Started working on unit tests
Fixed some bugs in the CSVColumn processor
This commit is contained in:
parent
1c08248c69
commit
8c7e9453ee
3 changed files with 70 additions and 5 deletions
5
csv.go
5
csv.go
|
|
@ -9,6 +9,7 @@ import (
|
|||
func CSVColumn(name string) func(r io.Reader, w io.Writer) error {
|
||||
return func(r io.Reader, w io.Writer) error {
|
||||
cr := csv.NewReader(r)
|
||||
cr.FieldsPerRecord = -1
|
||||
|
||||
header, err := cr.Read()
|
||||
if err != nil {
|
||||
|
|
@ -34,7 +35,7 @@ func CSVColumn(name string) func(r io.Reader, w io.Writer) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if len(rec) < colIdx {
|
||||
if len(rec) <= colIdx {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -46,4 +47,4 @@ func CSVColumn(name string) func(r io.Reader, w io.Writer) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue