github.com/searKing/golang/go@v1.2.74/util/object/stack.go (about)

     1  // Copyright 2020 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package object
     6  
     7  import (
     8  	"runtime"
     9  )
    10  
    11  func GetFunc() *runtime.Func {
    12  	pc, _, _, ok := runtime.Caller(1)
    13  	if !ok {
    14  		return nil
    15  	}
    16  	return runtime.FuncForPC(pc)
    17  }