Skip to content

Commit b2a8446

Browse files
authored
chore: fix ruleguard xerrors rules (#8967)
1 parent 31b7de6 commit b2a8446

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cli/stat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func (*RootCmd) statDisk(s *clistat.Statter) *clibase.Cmd {
240240
ds, err := s.Disk(pfx, pathArg)
241241
if err != nil {
242242
if os.IsNotExist(err) {
243-
// fmt.Errorf produces a more concise error.
243+
//nolint:gocritic // fmt.Errorf produces a more concise error.
244244
return fmt.Errorf("not found: %q", pathArg)
245245
}
246246
return err

scripts/rules.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ func xerrors(m dsl.Matcher) {
5151
m.Import("fmt")
5252
m.Import("golang.org/x/xerrors")
5353

54-
m.Match("fmt.Errorf($*args)").
55-
Suggest("xerrors.New($args)").
54+
m.Match("fmt.Errorf($arg)").
55+
Suggest("xerrors.New($arg)").
56+
Report("Use xerrors to provide additional stacktrace information!")
57+
58+
m.Match("fmt.Errorf($arg1, $*args)").
59+
Suggest("xerrors.Errorf($arg1, $args)").
5660
Report("Use xerrors to provide additional stacktrace information!")
5761

5862
m.Match("errors.$_($msg)").

0 commit comments

Comments
 (0)