just

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check added in v0.20.1

func Check(err error)

Check check no error or else panic.

func Try

func Try[T any](f func() T) (t T, err error)

Try recover panic from f and save the recovered value to error.

func TryDo

func TryDo(f func()) (err error)

TryDo is similar to Try but for function without 0 result.

func TryGo

func TryGo(f func()) <-chan error

TryGo spawn a new goroutine and recover panic from f and send the recovered value or nil to error chan.

func Want added in v0.19.3

func Want[T any](value T, err error) T

Want want to get value with no error or else panic.

Types

type PanicError

type PanicError struct {
	Value any
}

func (*PanicError) Error

func (p *PanicError) Error() string

Jump to

Keyboard shortcuts

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