Skip to content

Commit bafdccd

Browse files
authored
Merge pull request #132 from testwill/pkg
chore: pkg import only once
2 parents ea2a173 + 12b349a commit bafdccd

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

markers/markers_test.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package markers_test
1717
import (
1818
"context"
1919
"errors"
20-
goErr "errors"
2120
"fmt"
2221
"io"
2322
"net"
@@ -183,8 +182,8 @@ func TestKnownErrorTypeDifference(t *testing.T) {
183182
func TestStandardFmtSingleWrapRemoteEquivalence(t *testing.T) {
184183
tt := testutils.T{T: t}
185184

186-
err1 := fmt.Errorf("hello %w", goErr.New("world"))
187-
err2 := fmt.Errorf("hello %w", goErr.New("earth"))
185+
err1 := fmt.Errorf("hello %w", errors.New("world"))
186+
err2 := fmt.Errorf("hello %w", errors.New("earth"))
188187

189188
newErr1 := network(err1)
190189

@@ -281,8 +280,8 @@ func (e *myErr) Error() string {
281280
func TestStandardFmtMultierrorRemoteEquivalence(t *testing.T) {
282281
tt := testutils.T{T: t}
283282

284-
err1 := fmt.Errorf("hello %w %w", goErr.New("world"), goErr.New("one"))
285-
err2 := fmt.Errorf("hello %w %w", goErr.New("world"), goErr.New("two"))
283+
err1 := fmt.Errorf("hello %w %w", errors.New("world"), errors.New("one"))
284+
err2 := fmt.Errorf("hello %w %w", errors.New("world"), errors.New("two"))
286285

287286
newErr1 := network(err1)
288287

@@ -292,7 +291,7 @@ func TestStandardFmtMultierrorRemoteEquivalence(t *testing.T) {
292291
tt.Check(!markers.Is(newErr1, err2))
293292

294293
// Check multiple levels of causal nesting
295-
err3 := fmt.Errorf("err: %w", goErr.Join(err1, err2, &myErr{msg: "hi"}))
294+
err3 := fmt.Errorf("err: %w", errors.Join(err1, err2, &myErr{msg: "hi"}))
296295
newErr3 := network(err3)
297296
myErrV := &myErr{msg: "hi"}
298297

@@ -316,7 +315,7 @@ func (e myOtherMultiError) Unwrap() []error { return []error{e.cause} }
316315
func TestDifferentMultiErrorTypesCompareDifferentOverNetwork(t *testing.T) {
317316
tt := testutils.T{T: t}
318317

319-
base := goErr.New("woo")
318+
base := errors.New("woo")
320319
e1 := myMultiError{base}
321320
e2 := myOtherMultiError{base}
322321

@@ -333,9 +332,9 @@ func TestDifferentMultiErrorTypesCompareDifferentOverNetwork(t *testing.T) {
333332
func TestStandardFmtMultierrorRemoteRecursiveEquivalence(t *testing.T) {
334333
tt := testutils.T{T: t}
335334

336-
baseErr := goErr.New("world")
335+
baseErr := errors.New("world")
337336
err1 := fmt.Errorf("%w %w", baseErr, baseErr)
338-
err2 := goErr.Join(baseErr, baseErr)
337+
err2 := errors.Join(baseErr, baseErr)
339338

340339
tt.Check(markers.Is(err1, baseErr))
341340
tt.Check(!markers.Is(err1, err2))
@@ -633,7 +632,7 @@ func (e *myErrType2) Error() string { return e.msg }
633632
func TestFormat(t *testing.T) {
634633
tt := testutils.T{t}
635634

636-
refErr := goErr.New("foo")
635+
refErr := errors.New("foo")
637636
const woo = `woo`
638637
const waawoo = `waa: woo`
639638
testCases := []struct {
@@ -643,7 +642,7 @@ func TestFormat(t *testing.T) {
643642
expFmtVerbose string
644643
}{
645644
{"marked",
646-
markers.Mark(goErr.New("woo"), refErr),
645+
markers.Mark(errors.New("woo"), refErr),
647646
woo, `
648647
woo
649648
(1) forced error mark
@@ -653,7 +652,7 @@ Wraps: (2) woo
653652
Error types: (1) *markers.withMark (2) *errors.errorString`},
654653

655654
{"marked + wrapper",
656-
markers.Mark(&werrFmt{goErr.New("woo"), "waa"}, refErr),
655+
markers.Mark(&werrFmt{errors.New("woo"), "waa"}, refErr),
657656
waawoo, `
658657
waa: woo
659658
(1) forced error mark
@@ -666,7 +665,7 @@ Wraps: (3) woo
666665
Error types: (1) *markers.withMark (2) *markers_test.werrFmt (3) *errors.errorString`},
667666

668667
{"wrapper + marked",
669-
&werrFmt{markers.Mark(goErr.New("woo"), refErr), "waa"},
668+
&werrFmt{markers.Mark(errors.New("woo"), refErr), "waa"},
670669
waawoo, `
671670
waa: woo
672671
(1) waa

0 commit comments

Comments
 (0)