From 7baa8baf938e808b0344bb1f634dad2c913b147a Mon Sep 17 00:00:00 2001 From: Kouhei Sutou Date: Wed, 10 May 2017 14:21:16 +0900 Subject: [PATCH] [GLib] Add missing error checks in Go examples --- c_glib/example/go/write-batch.go | 10 ++++++++-- c_glib/example/go/write-stream.go | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/c_glib/example/go/write-batch.go b/c_glib/example/go/write-batch.go index f5e946a0c5c..78ef1beca4f 100644 --- a/c_glib/example/go/write-batch.go +++ b/c_glib/example/go/write-batch.go @@ -149,14 +149,20 @@ func main() { } recordBatch := arrow.NewRecordBatch(schema, 4, columns) - writer.WriteRecordBatch(recordBatch) + _, err = writer.WriteRecordBatch(recordBatch) + if err != nil { + log.Fatalf("Failed to write record batch #1: %v", err) + } slicedColumns := make([]*arrow.Array, len(columns)) for i, column := range columns { slicedColumns[i] = column.Slice(1, 3) } recordBatch = arrow.NewRecordBatch(schema, 3, slicedColumns) - writer.WriteRecordBatch(recordBatch) + _, err = writer.WriteRecordBatch(recordBatch) + if err != nil { + log.Fatalf("Failed to write record batch #2: %v", err) + } writer.Close() } diff --git a/c_glib/example/go/write-stream.go b/c_glib/example/go/write-stream.go index 80ebd2ba1b0..3f082702757 100644 --- a/c_glib/example/go/write-stream.go +++ b/c_glib/example/go/write-stream.go @@ -149,7 +149,10 @@ func main() { } recordBatch := arrow.NewRecordBatch(schema, 4, columns) - writer.WriteRecordBatch(recordBatch) + _, err = writer.WriteRecordBatch(recordBatch) + if err != nil { + log.Fatalf("Failed to write record batch #1: %v", err) + } slicedColumns := make([]*arrow.Array, len(columns)) for i, column := range columns { @@ -157,6 +160,10 @@ func main() { } recordBatch = arrow.NewRecordBatch(schema, 3, slicedColumns) writer.WriteRecordBatch(recordBatch) + _, err = writer.WriteRecordBatch(recordBatch) + if err != nil { + log.Fatalf("Failed to write record batch #2: %v", err) + } writer.Close() }