tool

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(b bool, fmts ...interface{})

func AssertFunc

func AssertFunc(target interface{})

func AssertPtr

func AssertPtr(ptr interface{})

func CheckFuncArgs

func CheckFuncArgs(a, b reflect.Type, shiftA, shiftB int) bool

func CheckReturnType

func CheckReturnType(fn interface{}, results ...interface{})

func DebugPrintf

func DebugPrintf(format string, a ...interface{})

func GetGoroutineID

func GetGoroutineID() int64

func IsDebug

func IsDebug() bool

func IsGCFlagsSet added in v1.2.7

func IsGCFlagsSet() bool

func ReflectCall

func ReflectCall(f reflect.Value, args []reflect.Value) []reflect.Value

func SetDebugMode

func SetDebugMode()

Types

type CallerInfo added in v1.1.0

type CallerInfo runtime.Frame

func Caller added in v1.1.0

func Caller() CallerInfo

func OuterCaller added in v1.1.0

func OuterCaller() (info CallerInfo)

Caller gets non-current package caller of a function For example, assume we have 3 files: a/b/foo.go, a/c/bar.go and a/c/innerBar.go, a/b/foo.Foo calls a/c/bar.Bar, and a/c/bar.Bar calls a/c/innerBar.innerBar. Here is how innerBar looks like:

func innerBar() CallerInfo { /*do some thing*/ return Caller() }

The return value of innerBar should represent the line in a/b/foo.go where a/b/foo.Foo calls a/c/bar.Bar

func (CallerInfo) String added in v1.1.0

func (c CallerInfo) String() string

Jump to

Keyboard shortcuts

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