README

exitcode GoDoc Go Report Card

Go package to convert errors to exit codes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit(err error)

    Exit is a convenience function that calls os.Exit with the exit code associated with err.

    func Get

    func Get(err error) int

      Get gets the exit code associated with an error. Cases:

      nil or flag.ErrHelp => 0
      errors implementing Coder => value returned by ExitCode
      all other errors => 1
      

      func Set

      func Set(err error, code int) error

        Set wraps an error in a Coder, setting its error code.

        Types

        type Coder

        type Coder interface {
        	error
        	ExitCode() int
        }

          Coder is an interface to control what value Get returns.

          Source Files