Remove Frame methods
errors.Frame is convertable from/to a runtime.Frame and know how to
print itself.
Signed-off-by: Dave Cheney <dave@cheney.net>
diff --git a/stack.go b/stack.go
index 23321e9..582b3e9 100644
--- a/stack.go
+++ b/stack.go
@@ -11,22 +11,6 @@
// Frame represents a program counter inside a stack frame.
type Frame runtime.Frame
-// file returns the full path to the file that contains the
-// function for this Frame's pc.
-func (f Frame) file() string {
- file := runtime.Frame(f).File
- if file == "" {
- return "unknown"
- }
- return file
-}
-
-// line returns the line number of source code of the
-// function for this Frame's pc.
-func (f Frame) line() int {
- return runtime.Frame(f).Line
-}
-
// Format formats the frame according to the fmt.Formatter interface.
//
// %s source file
@@ -52,10 +36,14 @@
fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
}
default:
- io.WriteString(s, path.Base(f.file()))
+ file := runtime.Frame(f).File
+ if file == "" {
+ file = "unknown"
+ }
+ io.WriteString(s, path.Base(file))
}
case 'd':
- fmt.Fprintf(s, "%d", f.line())
+ fmt.Fprintf(s, "%d", runtime.Frame(f).Line)
case 'n':
name := runtime.Frame(f).Function
io.WriteString(s, funcname(name))