Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsquire/dll
Go linter for finding defer statements inside for loops
https://github.com/gsquire/dll
go linter
Last synced: 6 days ago
JSON representation
Go linter for finding defer statements inside for loops
- Host: GitHub
- URL: https://github.com/gsquire/dll
- Owner: gsquire
- License: mit
- Created: 2018-10-19T23:38:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-27T20:43:52.000Z (12 months ago)
- Last Synced: 2024-11-01T07:33:21.463Z (13 days ago)
- Topics: go, linter
- Language: Go
- Size: 9.77 KB
- Stars: 25
- Watchers: 3
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dll
**D**efer **L**oop **L**inter
A simple linter to find `defer` statements inside of for loops in Go source.
## Other Works
See [Issue #12](https://github.com/gsquire/dll/issues/12) for an existing tool (`staticcheck`).## Why?
It's often erroneous to use `defer` inside of a loop as it can lead to memory leaks or other
unintended behavior. It can also be easy to miss this in a code review as using `defer` to
close sockets or files is a common Go idiom. This tool aims to point these out by simply printing
the line of a `defer` statement when it is found inside of a loop.## Install
```sh
go get github.com/gsquire/dll
```## Usage
```sh
dll source.godll *.go
```## Contributing
Found a bug? Found a case this didn't catch? Great! Feel free to open an issue or add a test case!## License
MIT