diff options
Diffstat (limited to 'vendor/github.com/gocarina/gocsv/encode.go')
| -rw-r--r-- | vendor/github.com/gocarina/gocsv/encode.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/github.com/gocarina/gocsv/encode.go b/vendor/github.com/gocarina/gocsv/encode.go index 4a87462..6e4e67b 100644 --- a/vendor/github.com/gocarina/gocsv/encode.go +++ b/vendor/github.com/gocarina/gocsv/encode.go @@ -17,7 +17,10 @@ func newEncoder(out io.Writer) *encoder { func writeFromChan(writer *csv.Writer, c <-chan interface{}) error { // Get the first value. It wil determine the header structure. - firstValue := <-c + firstValue, ok := <-c + if !ok { + return fmt.Errorf("channel is closed") + } inValue, inType := getConcreteReflectValueAndType(firstValue) // Get the concrete type if err := ensureStructOrPtr(inType); err != nil { return err |
