Skip to content

Commit

Permalink
mount: fix Go 1.20 errorlint warning
Browse files Browse the repository at this point in the history
Since Go 1.20,

> [t]he fmt.Errorf function now supports multiple occurrences of the %w
> format verb, which will cause it to return an error that wraps all of
> those error operands.

This change, together with newer errorlint, causes the following
warning:

> mount_unix.go:74:56: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
> 					return fmt.Errorf("%w (possible cause: %s)", err, suberr)
>					                                                  ^

Since Go < 1.20 is no longer supported, let's wrap both errors,
and set go version to 1.20 in go.mod

Fixes: 487129d
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Aug 25, 2023
1 parent 2b51f86 commit 3ab121c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mount/go.mod
@@ -1,6 +1,6 @@
module github.com/moby/sys/mount

go 1.16
go 1.20

require (
github.com/moby/sys/mountinfo v0.6.2
Expand Down
2 changes: 1 addition & 1 deletion mount/mount_unix.go
Expand Up @@ -71,7 +71,7 @@ func RecursiveUnmount(target string) error {
if err != nil {
if i == lastMount {
if suberr != nil {
return fmt.Errorf("%w (possible cause: %s)", err, suberr)
return fmt.Errorf("%w (possible cause: %w)", err, suberr)
}
return err
}
Expand Down

0 comments on commit 3ab121c

Please sign in to comment.