tool

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 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(b bool, fmts ...interface{})

func AssertFunc

func AssertFunc(target interface{})

func AssertPtr

func AssertPtr(ptr interface{})

func CheckFuncArgs

func CheckFuncArgs(a, b reflect.Type, shift 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 ReflectCall

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

func ReflectCallWithShiftOne

func ReflectCallWithShiftOne(f reflect.Value, args []reflect.Value, shift bool) []reflect.Value

func SetDebugMode

func SetDebugMode()

Types

type CallerInfo

type CallerInfo runtime.Frame

func Caller

func Caller() CallerInfo

func OuterCaller

func OuterCaller() 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

func (c CallerInfo) String() string

Jump to

Keyboard shortcuts

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