From d9389f6bbd4cc2d8faba039a30e3071031876441 Mon Sep 17 00:00:00 2001 From: Sherlock Holo Date: Fri, 8 Nov 2019 00:21:26 +0800 Subject: [PATCH] revert: revert some change some change are doing by PR #206 and #212 , so I don't need to do it Signed-off-by: Sherlock Holo --- .gitignore | 2 -- .travis.yml | 1 - errors.go | 21 +++++++++------------ go.mod | 5 ----- go.sum | 2 -- stack.go | 26 +++++++++++++------------- 6 files changed, 22 insertions(+), 35 deletions(-) delete mode 100644 go.mod delete mode 100644 go.sum diff --git a/.gitignore b/.gitignore index 11b90db..daf913b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,3 @@ _testmain.go *.exe *.test *.prof - -.idea diff --git a/.travis.yml b/.travis.yml index 1212a09..d2dfad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ go: - 1.10.x - 1.11.x - 1.12.x - - 1.13.x - tip script: diff --git a/errors.go b/errors.go index 1668a37..8617bee 100644 --- a/errors.go +++ b/errors.go @@ -128,15 +128,15 @@ func (f *fundamental) Format(s fmt.State, verb rune) { switch verb { case 'v': if s.Flag('+') { - _, _ = io.WriteString(s, f.msg) + io.WriteString(s, f.msg) f.stack.Format(s, verb) return } fallthrough case 's': - _, _ = io.WriteString(s, f.msg) + io.WriteString(s, f.msg) case 'q': - _, _ = fmt.Fprintf(s, "%q", f.msg) + fmt.Fprintf(s, "%q", f.msg) } } @@ -159,21 +159,19 @@ type withStack struct { func (w *withStack) Cause() error { return w.error } -func (w *withStack) Unwrap() error { return w.error } - func (w *withStack) Format(s fmt.State, verb rune) { switch verb { case 'v': if s.Flag('+') { - _, _ = fmt.Fprintf(s, "%+v", w.Cause()) + fmt.Fprintf(s, "%+v", w.Cause()) w.stack.Format(s, verb) return } fallthrough case 's': - _, _ = io.WriteString(s, w.Error()) + io.WriteString(s, w.Error()) case 'q': - _, _ = fmt.Fprintf(s, "%q", w.Error()) + fmt.Fprintf(s, "%q", w.Error()) } } @@ -242,19 +240,18 @@ type withMessage struct { func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } func (w *withMessage) Cause() error { return w.cause } -func (w *withMessage) Unwrap() error { return w.cause } func (w *withMessage) Format(s fmt.State, verb rune) { switch verb { case 'v': if s.Flag('+') { - _, _ = fmt.Fprintf(s, "%+v\n", w.Cause()) - _, _ = io.WriteString(s, w.msg) + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) return } fallthrough case 's', 'q': - _, _ = io.WriteString(s, w.Error()) + io.WriteString(s, w.Error()) } } diff --git a/go.mod b/go.mod deleted file mode 100644 index f157643..0000000 --- a/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/pkg/errors - -go 1.13 - -require golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 diff --git a/go.sum b/go.sum deleted file mode 100644 index 78d447d..0000000 --- a/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/stack.go b/stack.go index a4050d6..779a834 100644 --- a/stack.go +++ b/stack.go @@ -66,19 +66,19 @@ func (f Frame) Format(s fmt.State, verb rune) { case 's': switch { case s.Flag('+'): - _, _ = io.WriteString(s, f.name()) - _, _ = io.WriteString(s, "\n\t") - _, _ = io.WriteString(s, f.file()) + io.WriteString(s, f.name()) + io.WriteString(s, "\n\t") + io.WriteString(s, f.file()) default: - _, _ = io.WriteString(s, path.Base(f.file())) + io.WriteString(s, path.Base(f.file())) } case 'd': - _, _ = io.WriteString(s, strconv.Itoa(f.line())) + io.WriteString(s, strconv.Itoa(f.line())) case 'n': - _, _ = io.WriteString(s, funcname(f.name())) + io.WriteString(s, funcname(f.name())) case 'v': f.Format(s, 's') - _, _ = io.WriteString(s, ":") + io.WriteString(s, ":") f.Format(s, 'd') } } @@ -110,11 +110,11 @@ func (st StackTrace) Format(s fmt.State, verb rune) { switch { case s.Flag('+'): for _, f := range st { - _, _ = io.WriteString(s, "\n") + io.WriteString(s, "\n") f.Format(s, verb) } case s.Flag('#'): - _, _ = fmt.Fprintf(s, "%#v", []Frame(st)) + fmt.Fprintf(s, "%#v", []Frame(st)) default: st.formatSlice(s, verb) } @@ -126,14 +126,14 @@ func (st StackTrace) Format(s fmt.State, verb rune) { // formatSlice will format this StackTrace into the given buffer as a slice of // Frame, only valid when called with '%s' or '%v'. func (st StackTrace) formatSlice(s fmt.State, verb rune) { - _, _ = io.WriteString(s, "[") + io.WriteString(s, "[") for i, f := range st { if i > 0 { - _, _ = io.WriteString(s, " ") + io.WriteString(s, " ") } f.Format(s, verb) } - _, _ = io.WriteString(s, "]") + io.WriteString(s, "]") } // stack represents a stack of program counters. @@ -146,7 +146,7 @@ func (s *stack) Format(st fmt.State, verb rune) { case st.Flag('+'): for _, pc := range *s { f := Frame(pc) - _, _ = fmt.Fprintf(st, "\n%+v", f) + fmt.Fprintf(st, "\n%+v", f) } } }