From b819467576c3b16d8e51f284e5ac6a207f01a70a Mon Sep 17 00:00:00 2001 From: Kristóf Havasi Date: Wed, 5 May 2021 22:00:24 +0200 Subject: Add error checking in simple example for tx.Commit Based on https://golang.org/pkg/database/sql/#Tx.Commit this function returns an error type. So why not check it. --- _example/simple/simple.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '_example/simple') diff --git a/_example/simple/simple.go b/_example/simple/simple.go index 261ed4d..9d90773 100644 --- a/_example/simple/simple.go +++ b/_example/simple/simple.go @@ -42,7 +42,10 @@ func main() { log.Fatal(err) } } - tx.Commit() + err = tx.Commit() + if err != nil { + log.Fatal(err) + } rows, err := db.Query("select id, name from foo") if err != nil { -- cgit v1.2.3