internal/database: fix bug with error handling in transact

A bug is fixed with error handling in transact, due to a change in
commit 02f4e9876d3489f62e5fb8d28e6f4cc037271dfc. The change resulted in
the local error to be modified, instead of the return value which was
the desired behavior.

Change-Id: I59f778b2516fea72a40d90baad1d81b5c61d13db
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238246
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
diff --git a/internal/database/database.go b/internal/database/database.go
index 4aa41af..86d35d5 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -194,8 +194,8 @@
 		} else if err != nil {
 			tx.Rollback()
 		} else {
-			if err := tx.Commit(); err != nil {
-				err = fmt.Errorf("tx.Commit(): %w", err)
+			if txErr := tx.Commit(); txErr != nil {
+				err = fmt.Errorf("tx.Commit(): %w", txErr)
 			}
 		}
 	}()