Skip to content

Commit

Permalink
rm not used func args (linter)
Browse files Browse the repository at this point in the history
  • Loading branch information
lainio committed Feb 10, 2024
1 parent 41cda29 commit 2873776
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions err2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func TestPanickingCatchAll(t *testing.T) {
func() {
defer err2.Catch(
err2.Noop,
func(v any) {},
func(any) {},
)
panic("panic")
},
Expand All @@ -304,7 +304,7 @@ func TestPanickingCatchAll(t *testing.T) {
func() {
defer err2.Catch(
err2.Err(func(error) {}), // Using simplifier
func(v any) {},
func(any) {},
)
var b []byte
b[0] = 0
Expand Down Expand Up @@ -453,7 +453,7 @@ func TestPanicking_Handle(t *testing.T) {
func() (err error) {
defer err2.Handle(&err,
func(err error) error { return err },
func(p any) {},
func(any) {},
)
panic("panic")
},
Expand All @@ -463,7 +463,7 @@ func TestPanicking_Handle(t *testing.T) {
{"general panic stoped with handler",
args{
func() (err error) {
defer err2.Handle(&err, func(p any) {})
defer err2.Handle(&err, func(any) {})
panic("panic")
},
},
Expand All @@ -472,7 +472,7 @@ func TestPanicking_Handle(t *testing.T) {
{"general panic stoped with handler plus fmt string",
args{
func() (err error) {
defer err2.Handle(&err, func(p any) {}, "string")
defer err2.Handle(&err, func(any) {}, "string")
panic("panic")
},
},
Expand All @@ -492,7 +492,7 @@ func TestPanicking_Handle(t *testing.T) {
{"runtime.error panic stopped with handler",
args{
func() (err error) {
defer err2.Handle(&err, func(p any) {})
defer err2.Handle(&err, func(any) {})
var b []byte
b[0] = 0
return nil
Expand Down Expand Up @@ -600,12 +600,12 @@ func TestCatch_Panic(t *testing.T) {
}()

defer err2.Catch(
func(err error) error {
func(error) error {
t.Log("it was panic, not an error")
t.Fail() // we should not be here
return nil
},
func(v any) {
func(any) {
panicHandled = true
})

Expand Down
4 changes: 2 additions & 2 deletions try/out_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func ExampleOut1_copyFile() {

// If you prefer immediate error handling for some reason.
_ = try.Out1(io.Copy(w, r)).
Handle(io.EOF, func(err error) error {
Handle(io.EOF, func(error) error {
fmt.Println("err == io.EOF")
return nil // by returning nil we can reset the error
// return err // fallthru to next check if err != nil
Expand Down Expand Up @@ -136,7 +136,7 @@ func ExampleResult1_Handle() {
callRead := func(in io.Reader, b []byte) (eof bool, n int) {
// we should use try.To1, but this is sample of try.Out.Handle
n = try.Out1(in.Read(b)).
Handle(io.EOF, func(err error) error {
Handle(io.EOF, func(error) error {
eof = true
return nil
}). // our errors.Is == true, handler to get eof status
Expand Down

0 comments on commit 2873776

Please sign in to comment.