gitlab.com/evatix-go/core@v1.3.55/codestack/NewPtr.go (about)

     1  package codestack
     2  
     3  import (
     4  	"runtime"
     5  )
     6  
     7  func NewPtr(skipIndex int) *Trace {
     8  	pc, file, line, isOkay := runtime.Caller(skipIndex + defaultInternalSkip)
     9  	funcInfo := runtime.FuncForPC(pc)
    10  	fullFuncName := funcInfo.Name()
    11  
    12  	fullMethodSignature, packageName, methodName := MethodNamePackageName(fullFuncName)
    13  
    14  	return &Trace{
    15  		SkipIndex:         skipIndex,
    16  		PackageName:       packageName,
    17  		MethodName:        methodName,
    18  		PackageMethodName: fullMethodSignature,
    19  		FilePath:          file,
    20  		Line:              line,
    21  		IsOkay:            isOkay,
    22  	}
    23  }