Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
Assert does type assertion on v. v is asserted against T and *T. Assert returns true ok when v is either of T or *T. If v is nil of *T, then asserted is zero value of T.
func Escape ¶
func Escape[T any](v T) *T
Escape escapes v to a pointer of v.
It is useful when setting built-in type T (e.g. string, int) to struct fields of *T.
func ExtractError ¶
func ExtractError3 ¶
func Must ¶
Must unwraps error possibility from a set of return value from a function. Must panics if err is non nil error. The main use case is initialization of package-top level variables.
func initializeSomeValue() (int, error) {
return 0, errors.New("foo")
}
var SomeValue = Must(initializeSomeValue()) // this line panics, meaning incorrect implementation.
This example omits use of the init() function.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.