errscope

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: MIT Imports: 5 Imported by: 0

README

errscope

errscope finds code which can narrow the scope of error type.

func f() error {
  return errors.New("this is example")
}

func main() {
  err := f() // it can narrow the scope of error
  if err != nil {
    // error handling
  }
}

If you write code like below, errscope does not point out.

func main() {
  if err := f(); err != nil { // it is ok
    // error handling
  }
}

usage

$ go install gihtub.com/kimuson13/errscope/cmd/errscope@latest
$ errscope ./...

implement soon...

I want to implement the function that can ignore some result. For example

func main() {
  err := f() // ignore 
  if err != nil {
    // error handling
  }
}

This example code can narrow the scope of error type.
But corresponding line has comment such as "// ignore".
I expected that this line don't report by errscope.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "errscope",
	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