Remove deprecated Location interface
diff --git a/errors.go b/errors.go index fa30f02..e9b4e8d 100644 --- a/errors.go +++ b/errors.go
@@ -162,18 +162,11 @@ // Stacktrace() []Frame // } // -// type Location interface { -// Location() (file string, line int) -// } -// // Print will also print the file and line of the error. // If err is nil, nothing is printed. // // Deprecated: Fprint will be removed in version 0.7. func Fprint(w io.Writer, err error) { - type location interface { - Location() (string, int) - } type stacktrace interface { Stacktrace() []Frame } @@ -185,10 +178,7 @@ switch err := err.(type) { case stacktrace: frame := err.Stacktrace()[0] - fmt.Fprintf(w, "%+s:%d: ", frame, frame) - case location: - file, line := err.Location() - fmt.Fprintf(w, "%s:%d: ", file, line) + fmt.Fprintf(w, "%+v: ", frame) default: // de nada }
diff --git a/stack.go b/stack.go index 89c5784..882e051 100644 --- a/stack.go +++ b/stack.go
@@ -82,12 +82,6 @@ // Deprecated: use Stacktrace() func (s *stack) Stack() []uintptr { return *s } -// Deprecated: use Stacktrace()[0] -func (s *stack) Location() (string, int) { - frame := s.Stacktrace()[0] - return fmt.Sprintf("%+s", frame), frame.line() -} - func (s *stack) Stacktrace() []Frame { f := make([]Frame, len(*s)) for i := 0; i < len(f); i++ {
diff --git a/stack_test.go b/stack_test.go index d01b55d..36dbe6d 100644 --- a/stack_test.go +++ b/stack_test.go
@@ -41,20 +41,6 @@ } } -func TestStackLocation(t *testing.T) { - st := func() *stack { - var pcs [32]uintptr - n := runtime.Callers(1, pcs[:]) - var st stack = pcs[0:n] - return &st - }() - file, line := st.Location() - wfile, wline := "github.com/pkg/errors/stack_test.go", 47 - if file != wfile || line != wline { - t.Errorf("stack.Location(): want %q %d, got %q %d", wfile, wline, file, line) - } -} - type X struct{} func (x X) val() Frame {