Documentation

Overview

    Package must provides a handful of functions to express fatal assertions in Go programs. It is meant to alleviate cumbersome error handling and reporting when the only course of action is to fail the program. Package must is intended to be used by top-level binaries (i.e., in main packages); it should rarely be used elsewhere.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var Func func(...interface{}) = log.Panic

      Func is the function called to report an error and interrupt execution. Func is typically set to log.Panic or log.Fatal. It should be set before any potential calls to functions in the must package.

      Functions

      func Never

      func Never(v ...interface{})

        Never asserts that it is never called. If it is, it formats a message in the manner of fmt.Sprint and calls Func.

        func Neverf

        func Neverf(format string, v ...interface{})

          Neverf asserts that it is never called. If it is, it formats a message in the manner of fmt.Sprintf and calls Func.

          func Nil

          func Nil(v interface{}, args ...interface{})

            Nil asserts that v is nil; v is typically a value of type error. If v is not nil, Nil formats a message in hte manner of fmt.Sprint and calls must.Func. Nil also suffixes the message with the fmt.Sprint-formatted value of v.

            func Nilf

            func Nilf(v interface{}, format string, args ...interface{})

              Nilf asserts that v is nil; v is typically a value of type error. If v is not nil, Nilf formats a message in hte manner of fmt.Sprintf and calls must.Func. Nilf also suffixes the message with the fmt.Sprint-formatted value of v.

              func True

              func True(b bool, v ...interface{})

                True is a no-op if the value b is true. If it is false, True formats a message in the manner of fmt.Sprint and calls Func.

                func Truef

                func Truef(x bool, format string, v ...interface{})

                  Truef is a no-op if the value b is true. If it is false, True formats a message in the manner of fmt.Sprintf and calls Func.

                  Types

                  This section is empty.

                  Source Files