lostandfound

package
v0.0.0-...-68fadb2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DainChannel

func DainChannel[T any](c <-chan T)

Removes all pending elements from a channel, returns when channel is exhausted

func FileExists

func FileExists(path string) bool

func MapApply

func MapApply[S any, R any](s []S, f func(S) R) []R

return a new slice created from applying f to each item in s

func MapApplyIdx

func MapApplyIdx[S any, R any](s []S, f func(int, S) R) []R

return a new slice created from applying f to each item in s f is called with the index into the array

func RequireFileContent

func RequireFileContent(t *testing.T, path, content string)

func SetReset

func SetReset[T any](variable *T, newValue T) func()

Small helper to make it easy to reset a value You can do something like this:

enableSomething := False
...
defer SetReset(&enableSomething, true)()
( enableSomething will be True until the function exits)

func SliceSubtract

func SliceSubtract(a []string, b []string) []string

This isn't really optimized, I suspect that perhaps using maps would be faster, but at that point, we'd probably want to just implement or employ a "Set" type

Types

type MultipleError

type MultipleError struct {
	Op   string
	Errs []error
}

func (MultipleError) Error

func (e MultipleError) Error() string

func (MultipleError) Unwrap

func (e MultipleError) Unwrap() []error

Jump to

Keyboard shortcuts

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