util

package
v0.0.0-...-ff8e54b Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: AGPL-3.0, AGPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Overview

Package util contains various general utility functions used throughout the project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneBytes

func CloneBytes(b []byte) []byte

CloneBytes creates a copy of b

func HashBuffer

func HashBuffer(buf []byte) string

HashBuffer computes a base64 MD5 hash from a buffer

func PseudoRandInt

func PseudoRandInt(a, b int) int

Return a random integer N such that a <= N <= b.

func RunTasks

func RunTasks(tasks [][]Task) (err error)

Run tasks in the specified order. Exit on first error. Inspired by https://github.com/OverZealous/run-sequence

func Waterfall

func Waterfall(fns ...func() error) (err error)

Waterfall executes a slice of functions until the first error returned. This error, if any, is returned to the caller.

func WrapError

func WrapError(text string, err error) error

WrapError wraps error types to create compound error chains

Types

type Task

type Task func() error

Jump to

Keyboard shortcuts

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