https://github.com/ryanrolds/sqlclosecheck
Linter that confirms DB rows and statements are closed properly.
https://github.com/ryanrolds/sqlclosecheck
close go golang linter sql
Last synced: 1 day ago
JSON representation
Linter that confirms DB rows and statements are closed properly.
- Host: GitHub
- URL: https://github.com/ryanrolds/sqlclosecheck
- Owner: ryanrolds
- License: mit
- Created: 2020-06-29T16:50:34.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-05-19T04:04:50.000Z (11 months ago)
- Last Synced: 2025-05-19T04:31:53.632Z (11 months ago)
- Topics: close, go, golang, linter, sql
- Language: Go
- Homepage:
- Size: 1.65 MB
- Stars: 89
- Watchers: 3
- Forks: 19
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlclosecheck
Linter that checks if SQL rows/statements are closed. Unclosed rows and statements may
cause DB connection pool exhaustion. Included in `golangci-lint` as `sqlclosecheck`.
> Contributions are welcome. The original author is around, but this project is not near
> the top of his priorities. If you're interested taking an active role in the maintence
> and evolution of this linter, please reach out. Thank you.
## Analyzers
* `defer-only` - require that Close be deferred
* `closed` - require that Close be called (EXPERIMENTAL)
## Running
```
make build
make install
```
In your project directory:
```
go vet -vettool=$(which sqlclosecheck) ./...
```
## Developers
Start by creating a test that should pass/fail.
Test are located at `pkg/analyzer/testdata`.
All PRs that modify the analyzer should include a test.
Negative tests are just as important as positive tests.
Make changes to the analyzer (`pkg/analyzer`) and run the tests:
```
make test
```
## CI
GitHub Actions that runs on push to `main` and PRs.