diff options
author | Kristóf Havasi <lnksz@users.noreply.github.com> | 2021-05-05 22:00:24 +0200 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2022-05-28 23:40:45 +0900 |
commit | b819467576c3b16d8e51f284e5ac6a207f01a70a (patch) | |
tree | 681b1d19c918c10e027c3ec439df108cfd844778 | |
parent | Update _example/simple/Dockerfile (diff) | |
download | golite-b819467576c3b16d8e51f284e5ac6a207f01a70a.tar.gz golite-b819467576c3b16d8e51f284e5ac6a207f01a70a.tar.xz |
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.
-rw-r--r-- | _example/simple/simple.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 { |