github.com/gamechanger/errcheck@v0.0.0-20190204213044-2847c07a5541/README.md (about)

     1  YES THIS IS A FORK THAT IS SET TO A PREVIOUS VERSION 
     2  
     3  # errcheck
     4  ========
     5  
     6  errcheck is a program for checking for unchecked errors in go programs.
     7  
     8  [![Build Status](https://travis-ci.org/kisielk/errcheck.png?branch=master)](https://travis-ci.org/kisielk/errcheck)
     9  
    10  ## Install
    11  
    12      go get -u github.com/kisielk/errcheck
    13  
    14  errcheck requires Go 1.5 or newer and depends on the package go/loader from the golang.org/x/tools repository.
    15  
    16  ## Use
    17  
    18  For basic usage, just give the package path of interest as the first argument:
    19  
    20      errcheck github.com/kisielk/errcheck/testdata
    21  
    22  To check all packages beneath the current directory:
    23  
    24      errcheck ./...
    25  
    26  Or check all packages in your $GOPATH and $GOROOT:
    27  
    28      errcheck all
    29  
    30  Additionally, the following flags are available.
    31  
    32  The `-ignore` flag takes a comma-separated list of pairs of the form package:regex.
    33  For each package, the regex describes which functions to ignore within that package.
    34  The package may be omitted to have the regex apply to all packages.
    35  
    36  For example, you may wish to ignore common operations like Read and Write:
    37  
    38      errcheck -ignore '[rR]ead|[wW]rite' path/to/package
    39  
    40  or you may wish to ignore common functions like the `print` variants in `fmt`:
    41  
    42      errcheck -ignore 'fmt:[FS]?[Pp]rint*' path/to/package
    43  
    44  The `-ignorepkg` flag takes a comma-separated list of package import paths
    45  to ignore:
    46  
    47      errcheck -ignorepkg 'fmt,encoding/binary' path/to/package
    48  
    49  Note that this is equivalent to:
    50  
    51      errcheck -ignore 'fmt:.*,encoding/binary:.*' path/to/package
    52  
    53  If a regex is provided for a package `pkg` via `-ignore`, and `pkg` also appears
    54  in the list of packages passed to `-ignorepkg`, the latter takes precedence;
    55  that is, all functions within `pkg` will be ignored.
    56  
    57  Note that by default the `fmt` package is ignored entirely, unless a regex is
    58  specified for it. To disable this, specify a regex that matches nothing:
    59  
    60      errcheck -ignore 'fmt:a^' path/to/package
    61  
    62  The `-ignoretests` flag disables checking of `_test.go` files. It takes
    63  no arguments.
    64  
    65  The `-tags` flag takes a space-separated list of build tags, just like `go
    66  build`. If you are using any custom build tags in your code base, you may need
    67  to specify the relevant tags here.
    68  
    69  The `-asserts` flag enables checking for ignored type assertion results. It
    70  takes no arguments.
    71  
    72  The `-blank` flag enables checking for assignments of errors to the
    73  blank identifier. It takes no arguments.
    74  
    75  ## Cgo
    76  
    77  Currently errcheck is unable to check packages that `import "C"` due to limitations
    78  in the importer.
    79  
    80  However, you can use errcheck on packages that depend on those which use cgo. In
    81  order for this to work you need to `go install` the cgo dependencies before running
    82  errcheck on the dependant packages.
    83  
    84  See https://github.com/kisielk/errcheck/issues/16 for more details.
    85  
    86  ## Exit Codes
    87  
    88  errcheck returns 1 if any problems were found in the checked files.
    89  It returns 2 if there were any other failures.
    90  
    91  # Editor Integration
    92  
    93  ## Emacs
    94  
    95  [go-errcheck.el](https://github.com/dominikh/go-errcheck.el)
    96  integrates errcheck with Emacs by providing a `go-errcheck` command
    97  and customizable variables to automatically pass flags to errcheck.
    98  
    99  ## Vim
   100  
   101  [go-errcheck-vim](https://github.com/mattn/go-errcheck-vim)
   102  integrates errcheck with Vim's quickfix.