Skip to content

Commit 56ecd1e

Browse files
authored
fix: ignore .WithStack and .WithMessagef from github.com/pkg/errors (#15)
1 parent 5a99e6a commit 56ecd1e

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ ignoreSigs:
3535
- .Wrap(
3636
- .Wrapf(
3737
- .WithMessage(
38+
- .WithMessagef(
39+
- .WithStack(
3840
```
3941
4042
## Usage

wrapcheck/testdata/ignore_pkg_errors/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,13 @@ func do() error {
2424
return errors.WithMessage(err, "uh oh")
2525
}
2626

27-
return nil
27+
if err != nil {
28+
return errors.WithMessagef(err, "uh %s", "oh")
29+
}
30+
31+
if err != nil {
32+
return errors.WithStack(err)
33+
}
34+
35+
return errors.New("uh oh")
2836
}

wrapcheck/wrapcheck.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ var DefaultIgnoreSigs = []string{
1616
".Wrap(",
1717
".Wrapf(",
1818
".WithMessage(",
19+
".WithMessagef(",
20+
".WithStack(",
1921
}
2022

2123
// WrapcheckConfig is the set of configuration values which configure the

0 commit comments

Comments
 (0)