errwrp

package module
v0.0.0-...-c808c38 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

README

errwrp

return error semantics checker for golang. This tool reports return error statements without errors.Wrap(f).

Getting Started

Prerequisites
  • Go 1.11+
Installing
$ go get -u github.com/akito0107/errwrp/cmd/mustwrap-standalone

Options

$ mustwrap-standalone -h
NAME:
   mustwrap-standalone - check if return err with no errors.Wrap(f)

USAGE:
   mustwrap-standalone [OPTIONS]

VERSION:
   0.0.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --path value, -p value     check file name (or directory), acceptable for comma separated (required)
   --exclude value, -e value  exclude file name (or directory), acceptable for comma separated (default=vendor) (default: "vendor")
   --help, -h                 show help
   --version, -v              print the version

License

This project is licensed under the Apache License 2.0 License - see the LICENSE file for details

Documentation

Index

Constants

View Source
const IgnoreLine = "mustwrap: ignore"

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:             "mustwrap",
	Doc:              "check for just returning error without errors.Wrap",
	RunDespiteErrors: false,
	Run:              run,
}

Functions

This section is empty.

Types

type ErrorPkg

type ErrorPkg int
const (
	PkgErrors ErrorPkg = iota
	XErrors
	Fmt
	Unknown
)

func FromPkgName

func FromPkgName(name string) ErrorPkg

func (ErrorPkg) PkgName

func (e ErrorPkg) PkgName() string

type ImportPath

type ImportPath struct {
	Name string
	Pkg  ErrorPkg
}

type ParsedAST

type ParsedAST struct {
	ErrOrd                int
	AST                   *ast.FuncDecl
	FileName              string
	UsedErrorLikePackaged []ImportPath
}

func Parse

func Parse(r io.Reader, fname string) ([]*ParsedAST, *token.FileSet, ast.CommentMap, error)

type Result

type Result struct {
	Position token.Position
	Pos      token.Pos
	Fname    string
}

func Check

func Check(aset *ParsedAST, fset *token.FileSet, commMap ast.CommentMap) ([]*Result, error)

Directories

Path Synopsis
cmd
mustwrap command

Jump to

Keyboard shortcuts

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