Skip to content
/ txcheck Public

txcheck checks that you call Begin whenever you call DML functions

Notifications You must be signed in to change notification settings

mcesar/txcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

txcheck

txcheck is a program for checking that you call Begin whenever you call DML functions in go programs. Supports database/sql and github.com/gocraft/dbr.

Install

go get -u github.com/mcesar/txcheck

Use

For basic usage, just give the package path of interest as the first argument, for example:

txcheck github.com/mcesar/txcheck

Check

Given the following program, txcheck warns that function main calls Exec but does no call Begin (or BeginTx).

package main
import (
  "context"
  "database/sql"
)
var db *sql.DB
func main() {
  // tx, _ := db.Begin()
  db.Exec("INSERT INTO t(c) values('v');")
  // ...
}

About

txcheck checks that you call Begin whenever you call DML functions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages