exit

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package exit handles exit to OS

Index

Constants

View Source
const (
	// MNone set the exit mode at default. When Exit.Exit is called it exits
	// with the as normal with the supplied return code.
	MNone = iota
	// MPanic set the exit mode to panic. When Exit.Exit is called then a panic
	// will ensue instead of exiting.
	MPanic
)

Variables

View Source
var (
	// ExitMode is the current exit mode. Should be one of MNone or MPanic
	ExitMode int
)

Functions

func Exit

func Exit(code int)

Exit exit function with exit code. 0 is success

func Mode

func Mode(mode int) (ok bool)

Mode sets the exit mode for the exit.Exit call. Current modes are, exit.None (default - call exit mode directly) & exit.Panic (panic instead of exiting) Returns true if exit mode was was successfully set.

Types

type Handler

type Handler struct {
	Mode int `validate:"gte=0|lte=1"`
}

Handler exit handling

func (*Handler) Exit

func (e *Handler) Exit(code int)

Exit exit function with exit code. 0 is success

type HandlerIface

type HandlerIface interface {
	// Exit exit function with exit code. 0 is success
	Exit(code int)
}

HandlerIface ...

Jump to

Keyboard shortcuts

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