package
0.0.0-20240522063706-1b47e0dfeaa0
Repository: https://github.com/shevchukeugeni/metrics.git
Documentation: pkg.go.dev
# README
multichecker
This is a static analyzer for Go language, which includes various checks to ensure the code quality and adherence to best practices. It combines several analyzers from the go/analysis package, go-critic, and staticcheck libraries.
Features
- Checks for direct
os.Exit
call in themain
function of themain
package. - Checks for unnecessary
printf
calls. - Checks for shadowed variables.
- Checks for incorrect struct tags.
- Checks for potential issues using
go-critic
. - Checks for missing
bodyclose
calls. - Checks for various issues using
staticcheck
. - Checks for style issues using
stylecheck
.
Usage
Run go build multichecker.go
and put binary into project you'd like to check.
Then run ./multichecker .
to scan all files in your repo.
Example
Here is an example of a code that will trigger the ExitCheckAnalyzer
:
package main
import (
"os"
)
func main() {
os.Exit(0)
}
The analyzer will report the following issue:
direct call of os.Exit
# Variables
ExitCheckAnalyzer checks function main of package main for direct call of os.Exit.