refactor: remove redundant Begin() calls after NewSession auto-begins

Since NewSession() now auto-begins a transaction, explicit Begin()
calls are redundant (xorm's Begin() is a no-op when already in a
transaction). Removing them reduces confusion.

Special case: user_delete.go's loop previously called Begin/Commit
per user on a shared session. Restructured to create a new session
per user deletion so each gets its own transaction.
This commit is contained in:
kolaente
2026-02-24 11:50:35 +01:00
parent 764d3569ce
commit a6e6f252db
8 changed files with 16 additions and 75 deletions

View File

@@ -369,10 +369,6 @@ var userDeleteCmd = &cobra.Command{
s := db.NewSession()
defer s.Close()
if err := s.Begin(); err != nil {
log.Fatalf("Count not start transaction: %s", err)
}
u := getUserFromArg(s, args[0])
if userFlagDeleteNow {