https://github.com/400f/sqlpassctxcheck
A program for checking for sql module method call without ctx.
https://github.com/400f/sqlpassctxcheck
golang golangci-lint linter sql
Last synced: 5 months ago
JSON representation
A program for checking for sql module method call without ctx.
- Host: GitHub
- URL: https://github.com/400f/sqlpassctxcheck
- Owner: 400f
- License: mit
- Created: 2022-12-03T20:05:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-03T09:06:10.000Z (10 months ago)
- Last Synced: 2025-10-19T10:24:49.073Z (8 months ago)
- Topics: golang, golangci-lint, linter, sql
- Language: Go
- Homepage: https://pkg.go.dev/github.com/400f/sqlpassctxcheck
- Size: 3.43 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sqlpassctxcheck
sqlpassctxcheck is a program for checking for sql module method call without ctx.
Using this tool, you can avoid falling outside of distributed tracing by forgetting to pass the context.
## Install
```
go install github.com/400f/sqlpassctxcheck/cmd/sqlpassctxcheck@latest
```
## Usage
```go
package main
import "database/sql"
func Call(db *sql.DB) {
rows, err := db.Query("SELECT * FROM foo")
if err != nil {
return err
}
// ...
}
```
```
$ go vet -vettool=(which sqlpassctxcheck) ./...
main.go:6:15 use (*database/sql.DB).QueryContext instead of (*database/sql.DB).Query
```
## Develop
```sh
$ go test -v ./
```