Documentation
¶
Overview ¶
Package runtimex contains runtime extensions. This package is inspired to https://pkg.go.dev/github.com/m-lab/go/rtx, except that it's simpler.
Index ¶
- Variables
- func Assert(assertion bool, message string)
- func PanicIfNil(v any, message string)
- func PanicIfTrue(assertion bool, message string)
- func PanicOnError(err error, message string)
- func Try0(err error)
- func Try1[T1 any](v1 T1, err error) T1
- func Try2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2)
- func Try3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)
- type BuildInfoRecord
Constants ¶
This section is empty.
Variables ¶
var BuildInfo = &BuildInfoRecord{}
BuildInfo is the singleton containing build-time information.
Functions ¶
func Assert ¶
Assert calls panic if assertion is false. The type passed to panic is an error constructed using errors.New(message).
func PanicIfNil ¶
PanicIfNil calls panic if the given interface is nil. The type passed to panic is an error constructed using errors.New(message).
func PanicIfTrue ¶
PanicIfTrue calls panic if assertion is true. The type passed to panic is an error constructed using errors.New(message).
func PanicOnError ¶
PanicOnError calls panic() if err is not nil. The type passed to panic is an error type wrapping the original error.
Types ¶
type BuildInfoRecord ¶
type BuildInfoRecord struct {
// GoVersion is the version of go with which this code
// was compiled or an empty string.
GoVersion string
// VcsModified indicates whether the tree was dirty.
VcsModified string
// VcsRevision is the VCS revision we compiled.
VcsRevision string
// VcsTime is the time of the revision we're building.
VcsTime string
// VcsTool is the VCS tool being used.
VcsTool string
}
BuildInfoRecord contains build-time information.