3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
14 println(caller().frame.Function)
16 // Used to erroneously print "main.call.name" instead of
18 println(caller().name())
23 n := runtime.Callers(1, pcs[:])
24 frames := runtime.CallersFrames(pcs[:n])
25 frame, _ := frames.Next()
26 frame, _ = frames.Next()
28 return call{frame: frame}
35 func (c call) name() string {
36 return c.frame.Function