Back to

Package exitcode

Latest Go to latest

The latest major version is .

Published: Mar 10, 2020 | License: MIT | Module:


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 => 0
errors implementing Coder => value returned by ExitCode
flag.ErrHelp => 2
all other errors => 1

func Set

func Set(err error, code int) error

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

type Coder

type Coder interface {
	ExitCode() int

Coder is an interface to control what value Get returns.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier