Documentation
¶
Overview ¶
Package must contains simple functions that panic on errors.
It should only be used in tests and rare places where errors are provably impossible.
Index ¶
- func Chdir(dir string)
- func CreateEmpty(names ...string)
- func MkdirAll(names ...string)
- func OK(err error)
- func OK1[T any](v T, err error) T
- func OK2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2)
- func Pipe() (*os.File, *os.File)
- func ReadAllAndClose(r io.ReadCloser) []byte
- func ReadFile(fname string) []byte
- func ReadFileString(fname string) string
- func WriteFile(filename, data string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEmpty ¶
func CreateEmpty(names ...string)
CreateEmpty creates empty file, after creating all ancestor directories that don't exist.
func OK ¶
func OK(err error)
OK panics if the error value is not nil. It is intended for use with functions that return just an error.
func OK1 ¶
OK1 panics if the error value is not nil. It is intended for use with functions that return one value and an error.
func OK2 ¶
OK2 panics if the error value is not nil. It is intended for use with functions that return two values and an error.
func ReadAllAndClose ¶
func ReadAllAndClose(r io.ReadCloser) []byte
ReadAll wraps io.ReadAll and io.Closer.Close.
func ReadFileString ¶
ReadFileString converts the result of ReadFile to a string.
Types ¶
This section is empty.