errorcheck

package
v0.0.0-...-e2e2fe3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package errcheck is the library used to implement the errcheck command-line tool.

Note: The API of this package has not been finalized and may change at any point.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoGoFiles is returned when CheckPackage is run on a package with no Go source files
	ErrNoGoFiles = errors.New("package contains no go source files")
)

Functions

func ErrorCheck

func ErrorCheck(projectPath string) []string

Types

type Checker

type Checker struct {
	// ignore is a map of package names to regular expressions. Identifiers from a package are
	// checked against its regular expressions and if any of the expressions match the call
	// is not checked.
	Ignore map[string]*regexp.Regexp

	// If blank is true then assignments to the blank identifier are also considered to be
	// ignored errors.
	Blank bool

	// If asserts is true then ignored type assertion results are also checked
	Asserts bool

	// build tags
	Tags []string

	Verbose bool

	// If true, checking of of _test.go files is disabled
	WithoutTests bool
	// contains filtered or unexported fields
}

func NewChecker

func NewChecker() *Checker

func (*Checker) CheckPackages

func (c *Checker) CheckPackages(paths ...string) ([]string, error)

CheckPackages checks packages for errors.

func (*Checker) SetExclude

func (c *Checker) SetExclude(l map[string]bool)

type UncheckedError

type UncheckedError struct {
	Pos      token.Position
	Line     string
	FuncName string
}

UncheckedError indicates the position of an unchecked error return.

type UncheckedErrors

type UncheckedErrors struct {

	// Errors is a list of all the unchecked errors in the package.
	// Printing an error reports its position within the file and the contents of the line.
	Errors []UncheckedError
	// contains filtered or unexported fields
}

UncheckedErrors is returned from the CheckPackage function if the package contains any unchecked errors. Errors should be appended using the Append method, which is safe to use concurrently.

func (*UncheckedErrors) Append

func (e *UncheckedErrors) Append(errors ...UncheckedError)

func (*UncheckedErrors) Error

func (e *UncheckedErrors) Error() string

func (*UncheckedErrors) Len

func (e *UncheckedErrors) Len() int

Len is the number of elements in the collection.

func (*UncheckedErrors) Swap

func (e *UncheckedErrors) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Directories

Path Synopsis
This file exists so that we can check that multi-file packages work
This file exists so that we can check that multi-file packages work

Jump to

Keyboard shortcuts

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