blankerr

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 6 Imported by: 0

README

blankerr

blankerr is check blank err return values and check call function without error handling

Install

$ go install github.com/kimuson13/blankerr/cmd/blankerr@latest

How to use

If you want to check error with a package, give th e package path of interst as the first argument:

$ blankerr github.com/kimuson13/blankerr

To check all package beneath the current directory:

$ blankerr ./...

Demo

If you create such a Go file bellow

$ ls
a.go
$ cat a.go
package a

import "errors"

func hoge() (string, error) {
    return "hoge", errors.New("hoge")
}

func fuga() {
    h, _ := hoge()
    print(h)
}

func fuga() ignores error in return values of hoge(). We need to handle this error. So use blankerr like that.

$ blankerr a
a/a.go:16:9 hoge has error type in return values

blankerr help error handling

Feature Outlook

not check some standard libraly

Some standard library that have an error return type but are documented to never return an error(eg: fmt.Print())
So, I want to ignore these functions.

Documentation

Index

Constants

This section is empty.

Variables

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

Analyzer is ...

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