package other

import "git.mstar.dev/mstar/goutils/other"

Package other contains various funtions that didn't fit into any of the other packages

Index

Functions

func ConfigureLogging

func ConfigureLogging(logWriter io.Writer)

Configure logging. Utilises the flags setup in SetupFlags. If logWriter is not nil, will also write logs, as json objects, to the given writer

func Error

func Error(source, message string, err error) error

Error formats error messages to follow a common convention of "source: message: wrapped error"

func IntoPointer

func IntoPointer[T any](val T) *T

IntoPointer returns a pointer to the given value

func Must

func Must[T any](val T, err error) T

Must is a quick wrapper to ensure that a function exits without error. If err is not nil, it panics. Otherwise val is returned. The intended use is something like Must(someFunc()), where someFunc has the signature someFunc() (T, error), with T being whatever type needed

func OutputIntoChannel

func OutputIntoChannel[T any](out T, target chan T)

OutputIntoChannel takes a singular return value and sends it into the target channel. This is a wrapper for functions where a value can't be collected from directly. Example: goroutines

func SetupFlags

func SetupFlags()

Source Files

other.go zerolog.go

Version
v1.15.0 (latest)
Published
Jun 6, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
1 hour ago

Tools for package owners.