MCPcopy Index your code
hub / github.com/go-errors/errors / packageAndName

Function packageAndName

stackframe.go:99–122  ·  view source on GitHub ↗
(fn *runtime.Func)

Source from the content-addressed store, hash-verified

97}
98
99func packageAndName(fn *runtime.Func) (string, string) {
100 name := fn.Name()
101 pkg := ""
102
103 // The name includes the path name to the package, which is unnecessary
104 // since the file name is already included. Plus, it has center dots.
105 // That is, we see
106 // runtime/debug.*T·ptrmethod
107 // and want
108 // *T.ptrmethod
109 // Since the package path might contains dots (e.g. code.google.com/...),
110 // we first remove the path prefix if there is one.
111 if lastslash := strings.LastIndex(name, "/"); lastslash >= 0 {
112 pkg += name[:lastslash] + "/"
113 name = name[lastslash+1:]
114 }
115 if period := strings.Index(name, "."); period >= 0 {
116 pkg += name[:period]
117 name = name[period+1:]
118 }
119
120 name = strings.Replace(name, "·", ".", -1)
121 return pkg, name
122}

Callers 1

NewStackFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…