Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 9c1c579

Browse files
committed
remove causer
1 parent 4dd713c commit 9c1c579

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

errors.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,3 @@ func Cause(err error) error {
3333
}
3434
return err
3535
}
36-
37-
// cause implements the interface required by Cause.
38-
type cause struct {
39-
err error
40-
}
41-
42-
func (c *cause) Cause() error {
43-
return c.err
44-
}

errors_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ type nilError struct{}
3838
func (nilError) Error() string { return "nil error" }
3939

4040
type causeError struct {
41-
cause
41+
cause error
4242
}
4343

4444
func (e *causeError) Error() string { return "cause error" }
45+
func (e *causeError) Cause() error { return e.cause }
4546

4647
func TestCause(t *testing.T) {
4748
tests := []struct {
@@ -65,7 +66,7 @@ func TestCause(t *testing.T) {
6566
want: io.EOF,
6667
}, {
6768
// caused error returns cause
68-
err: &causeError{cause{err: io.EOF}},
69+
err: &causeError{cause: io.EOF},
6970
want: io.EOF,
7071
}}
7172

0 commit comments

Comments
 (0)