Skip to content

Commit dfaaa91

Browse files
dpinelajba
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 5881d85 commit dfaaa91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/os/error.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func NewSyscallError(syscall string, err error) error {
7171
return &SyscallError{syscall, err}
7272
}
7373

74-
// IsExist returns a boolean indicating whether the error is known to report
74+
// IsExist returns a boolean indicating whether its argument is known to report
7575
// that a file or directory already exists. It is satisfied by [ErrExist] as
7676
// well as some syscall errors.
7777
//
@@ -81,7 +81,7 @@ func IsExist(err error) bool {
8181
return underlyingErrorIs(err, ErrExist)
8282
}
8383

84-
// IsNotExist returns a boolean indicating whether the error is known to
84+
// IsNotExist returns a boolean indicating whether its argument is known to
8585
// report that a file or directory does not exist. It is satisfied by
8686
// [ErrNotExist] as well as some syscall errors.
8787
//
@@ -91,7 +91,7 @@ func IsNotExist(err error) bool {
9191
return underlyingErrorIs(err, ErrNotExist)
9292
}
9393

94-
// IsPermission returns a boolean indicating whether the error is known to
94+
// IsPermission returns a boolean indicating whether its argument is known to
9595
// report that permission is denied. It is satisfied by [ErrPermission] as well
9696
// as some syscall errors.
9797
//
@@ -101,7 +101,7 @@ func IsPermission(err error) bool {
101101
return underlyingErrorIs(err, ErrPermission)
102102
}
103103

104-
// IsTimeout returns a boolean indicating whether the error is known
104+
// IsTimeout returns a boolean indicating whether its argument is known
105105
// to report that a timeout occurred.
106106
//
107107
// This function predates [errors.Is], and the notion of whether an

0 commit comments

Comments
 (0)