From ea18f34f9d3f308b587515399fc5dd1af69c5379 Mon Sep 17 00:00:00 2001 From: lorneli Date: Sun, 10 Sep 2017 14:53:37 +0800 Subject: [PATCH] db: return t.Rollback directly in the end of View function Make return line of db.View corresponding with db.Update. --- db.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/db.go b/db.go index e447503..6559f41 100644 --- a/db.go +++ b/db.go @@ -687,11 +687,7 @@ func (db *DB) View(fn func(*Tx) error) error { return err } - if err := t.Rollback(); err != nil { - return err - } - - return nil + return t.Rollback() } // Batch calls fn as part of a batch. It behaves similar to Update,