mu

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: BSD-3-Clause Imports: 3 Imported by: 38

README

Go package that contains miscellaneous utility functions.

Documentation

Overview

Package mu (mini utility) contains miscellaneous utility functions that are generally useful for most projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BUG

func BUG(format string, a ...any)

BUG simply invokes Panicf, but prepends the message with "bug: "

func BoolToInt

func BoolToInt(b bool) int

BoolToInt converts a bool to int. It returns 1 if b is true and 0 if b is false.

func Fatalf

func Fatalf(format string, a ...any)

Fatalf writes a message to stderr, and then calls os.Exit(1). Arguments are handled in the manner of fmt.Fprintf. If format does not end in a newline, this function adds one.

func IntToBool added in v0.2.0

func IntToBool(i int) bool

IntToBool converts an int to a bool. It returns true if i is nonzero, and false if i is zero.

func Panicf

func Panicf(format string, a ...any)

Panicf invokes panic() with a message. Arguments are handled in the manner of fmt.Sprintf.

func UNUSED

func UNUSED(v ...any)

UNUSED is a noop function that is primarily used during development to silence build errors of the form "variable x declared and not used." UNUSED takes a variable number of arguments, and thus may silence such errors for multiple variables with a single call.

Example:

a, b, err = foo()
if err != nil {
    mu.Fatalf("error: %v", err)
}
mu.UNUSED(a, b)

Types

This section is empty.

Jump to

Keyboard shortcuts

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