debugutil

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(cond bool)

func CheckAndFatalIfError

func CheckAndFatalIfError(err error, msg string)

func GoAssertEqual

func GoAssertEqual(t *testing.T, expected, actual any, msg string)

TODO: compare with assert.equal

func GoAssertTrue

func GoAssertTrue(t *testing.T, bAssert bool, msg string)

func SafeClose

func SafeClose(closer io.Closer)

********************************************************************************************************************** * 注意: * 1.如果是通过 defer 调用的话, 定位出来的位置通常在调用函数的结束位置, 推荐使用 SafeCloseMsg() 方便定位 * 2.常见错误: * fs.ErrClosed <== *fs.PathError(close |0: file already closed) **********************************************************************************************************************

func SafeCloseMsg

func SafeCloseMsg(closer io.Closer, msg string)

func Verify

func Verify(err error) error

func VerifyExcept1

func VerifyExcept1(err error, ex1 error) error

func VerifyWithConfig

func VerifyWithConfig(err error, config *Config) error

func VerifyWithMessage

func VerifyWithMessage(err error, msg string) error

func VerifyWithResult

func VerifyWithResult[T any](result T, err error) T

func VerifyWithResultEx

func VerifyWithResultEx[T any](result T, err error) (T, error)

func VerifyWithTwoResult

func VerifyWithTwoResult[R1 any, R2 any](r1 R1, r2 R2, err error) (R1, R2)

two result without error

func VerifyWithTwoResultEx

func VerifyWithTwoResultEx[R1 any, R2 any](r1 R1, r2 R2, err error) (R1, R2, error)

two result with error

Types

type CheckErrorAction

type CheckErrorAction int
const (
	ACTION_FATAL_QUIT CheckErrorAction = iota
	ACTION_LOG_ERROR
)

type Config

type Config struct {
	MoreSkip         int
	Message          string
	IgnoreExceptions []error
}

Jump to

Keyboard shortcuts

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