mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: clarify that IsNotExist, IsExist, IsPermission and IsTimeout work with nil errors
Referring to these functions' parameter as "*the* error" could be taken to imply that a non-nil error from elsewhere is expected; referring to it as "its argument" avoids that ambiguity. Fixes #31065 Change-Id: I117892dd53fff6f92d11a416e4abedee5d2f9337 Reviewed-on: https://go-review.googlesource.com/c/go/+/170077 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
5881d857c5
commit
dfaaa91f05
1 changed files with 4 additions and 4 deletions
|
|
@ -71,7 +71,7 @@ func NewSyscallError(syscall string, err error) error {
|
||||||
return &SyscallError{syscall, err}
|
return &SyscallError{syscall, err}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsExist returns a boolean indicating whether the error is known to report
|
// IsExist returns a boolean indicating whether its argument is known to report
|
||||||
// that a file or directory already exists. It is satisfied by [ErrExist] as
|
// that a file or directory already exists. It is satisfied by [ErrExist] as
|
||||||
// well as some syscall errors.
|
// well as some syscall errors.
|
||||||
//
|
//
|
||||||
|
|
@ -81,7 +81,7 @@ func IsExist(err error) bool {
|
||||||
return underlyingErrorIs(err, ErrExist)
|
return underlyingErrorIs(err, ErrExist)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsNotExist returns a boolean indicating whether the error is known to
|
// IsNotExist returns a boolean indicating whether its argument is known to
|
||||||
// report that a file or directory does not exist. It is satisfied by
|
// report that a file or directory does not exist. It is satisfied by
|
||||||
// [ErrNotExist] as well as some syscall errors.
|
// [ErrNotExist] as well as some syscall errors.
|
||||||
//
|
//
|
||||||
|
|
@ -91,7 +91,7 @@ func IsNotExist(err error) bool {
|
||||||
return underlyingErrorIs(err, ErrNotExist)
|
return underlyingErrorIs(err, ErrNotExist)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsPermission returns a boolean indicating whether the error is known to
|
// IsPermission returns a boolean indicating whether its argument is known to
|
||||||
// report that permission is denied. It is satisfied by [ErrPermission] as well
|
// report that permission is denied. It is satisfied by [ErrPermission] as well
|
||||||
// as some syscall errors.
|
// as some syscall errors.
|
||||||
//
|
//
|
||||||
|
|
@ -101,7 +101,7 @@ func IsPermission(err error) bool {
|
||||||
return underlyingErrorIs(err, ErrPermission)
|
return underlyingErrorIs(err, ErrPermission)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsTimeout returns a boolean indicating whether the error is known
|
// IsTimeout returns a boolean indicating whether its argument is known
|
||||||
// to report that a timeout occurred.
|
// to report that a timeout occurred.
|
||||||
//
|
//
|
||||||
// This function predates [errors.Is], and the notion of whether an
|
// This function predates [errors.Is], and the notion of whether an
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue