varerr

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: MIT Imports: 5 Imported by: 0

README

sleuth

test_and_lint

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` ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "varerr",
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
	},
}

Analyzer is the varerr analyzer

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL