sleuth

varerr checks that you initialize error type.
If you don't wanna check it, you can pass this linter check with novarerr
tag.
Instruction
go install github.com/sivchari/varerr/cmd/varerr
Usage
var err error
err = funcA()
if err != nil {
...
}
err = funcB()
if err != nil {
...
}
fish
$ go vet -vettool=(which varerr) ./...
bash
$ go vet -vettool=`which varerr` ./...
output
The error type `err` is initialized with var
above code can been fixed
if err := funcA(); err != nil {
...
}
if err := funcB(); err != nil {
...
}
Ignoring issues
You can ignore a particular issue by including the directive // novarerr on that line
var err error // novarerr
CI
CircleCI
- run:
name: Install varerr
command: go get github.com/sivchari/varerr
- run:
name: Run varerr
command: go vet -vettool=`which varerr` ./...
GitHub Actions
- name: Install varerr
run: go get github.com/sivchari/varerr
- name: Run varerr
run: go vet -vettool=`which varerr` ./...