mu

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause Imports: 3 Imported by: 20

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 added in v0.2.0

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

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

func BoolToInt added in v0.2.0

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.

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