wraperr

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: MIT Imports: 10 Imported by: 0

README

wraperr

Go project version

Check that error return value are wrapped

Install

go get -u github.com/izumin5210/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 (
	// 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 Detector

type Detector interface {
	CheckPackages(paths []string) error
}

func NewDetector

func NewDetector() Detector

type Package

type Package struct {
	*types.Package
	*types.Info
	Files []*ast.File
}

type UnwrappedError

type UnwrappedError struct {
	Position token.Position
	Pkgname  string
	Funcname string
}

type UnwrappedErrors

type UnwrappedErrors interface {
	error

	Errors() []*UnwrappedError
	Add(*UnwrappedError)
}

func UnwrapUnwrappedErrorsError

func UnwrapUnwrappedErrorsError(err error) (uerr UnwrappedErrors, ok bool)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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