wraperr

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 9 Imported by: 0

README

wraperr

Build Status codecov Go project version Go Report Card license

Check that error return value are wrapped

Install

go get -u github.com/srvc/wraperr/cmd/wraperr

Usage

To check all packages beneath the current directory:

wraperr ./...

Inspired

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "wraperr",
	Doc:      "Check that error return value are wrapped",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      runAnalyze,
}
View Source
var (
	// WrapperFuncList contains "path/to/pkg.Funcname" strings that adds a context to errors.
	WrapperFuncList = []string{

		"errors.New",
		"fmt.Errorf",

		"github.com/pkg/errors.Errorf",
		"github.com/pkg/errors.New",
		"github.com/pkg/errors.WithMessage",
		"github.com/pkg/errors.WithStack",
		"github.com/pkg/errors.Wrap",
		"github.com/pkg/errors.Wrapf",

		"github.com/srvc/fail.Errorf",
		"github.com/srvc/fail.New",
		"github.com/srvc/fail.Wrap",
	}
)

Functions

This section is empty.

Types

type Checker added in v0.3.0

type Checker interface {
	Check(ReportFunc)
}

func NewChecker added in v0.3.0

func NewChecker(
	fset *token.FileSet,
	info *types.Info,
	f *ast.FuncDecl,
) Checker

type ReportFunc added in v0.3.0

type ReportFunc func(assignedAt, returnedAt token.Pos)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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