]> Cypherpunks repositories - gostls13.git/commitdiff
os: document error returned by pending I/O operations on Close
authorAustin Clements <austin@google.com>
Sat, 11 Dec 2021 02:09:16 +0000 (21:09 -0500)
committerAustin Clements <austin@google.com>
Sun, 12 Dec 2021 14:36:22 +0000 (14:36 +0000)
Currently, File.Close only documents that "an" error will be returned
by pending I/O operations. Update the documentation to say that error
is specifically ErrClosed.

Change-Id: Ica817c9196ad6cb570c826789d37a4ff15a5d13d
Reviewed-on: https://go-review.googlesource.com/c/go/+/371015
Trust: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/file_plan9.go
src/os/file_posix.go

index 604aea607bcf304e4ac111fbdd4aeb4e3c596cc0..887e1c889232b3536c0e6db2483b42b66ac8b4bb 100644 (file)
@@ -139,7 +139,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
 
 // Close closes the File, rendering it unusable for I/O.
 // On files that support SetDeadline, any pending I/O operations will
-// be canceled and return immediately with an error.
+// be canceled and return immediately with an ErrClosed error.
 // Close will return an error if it has already been called.
 func (f *File) Close() error {
        if err := f.checkValid("close"); err != nil {
index 0dc6da090879364b68dd9964dfa9ae0c2c32d613..f34571d68d78ec05a5c81cfa05338d6c0871958c 100644 (file)
@@ -16,7 +16,7 @@ func sigpipe() // implemented in package runtime
 
 // Close closes the File, rendering it unusable for I/O.
 // On files that support SetDeadline, any pending I/O operations will
-// be canceled and return immediately with an error.
+// be canceled and return immediately with an ErrClosed error.
 // Close will return an error if it has already been called.
 func (f *File) Close() error {
        if f == nil {