From 8a541d499b6f117cd3a81e475ee779ba60fc0637 Mon Sep 17 00:00:00 2001 From: Felix Hanley Date: Sun, 19 Mar 2017 22:19:42 +0700 Subject: use golang dep tool for deps --- vendor/github.com/gocarina/gocsv/encode.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vendor/github.com/gocarina/gocsv/encode.go') 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 -- cgit v1.2.3