Skip to content

Commit 1baefaa

Browse files
committed
feat: use std errors.New when not tracing
1 parent 2ebf677 commit 1baefaa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

errors.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
package errors
66

7-
import "fmt"
7+
import (
8+
"errors"
9+
"fmt"
10+
)
811

912
// errorString is a trivial implementation of error.
1013
type errorString struct {
@@ -18,14 +21,12 @@ type errorString struct {
1821
// implements Formatter to show this information when printed with details.
1922
func New(text string) error {
2023
if !Trace() {
21-
return &errorString{s: text}
24+
return errors.New(text)
2225
}
2326
return &errorString{text, Caller(1)}
2427
}
2528

26-
func (e *errorString) Error() string {
27-
return e.s
28-
}
29+
func (e *errorString) Error() string { return e.s }
2930

3031
func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) }
3132

0 commit comments

Comments
 (0)