From: Austin Clements Date: Sat, 11 Dec 2021 02:09:16 +0000 (-0500) Subject: os: document error returned by pending I/O operations on Close X-Git-Tag: go1.18beta1~22 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=56817040d53187abcd568af0eea27cc21379c0ad;p=gostls13.git os: document error returned by pending I/O operations on Close 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 Reviewed-by: Ian Lance Taylor --- diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go index 604aea607b..887e1c8892 100644 --- a/src/os/file_plan9.go +++ b/src/os/file_plan9.go @@ -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 { diff --git a/src/os/file_posix.go b/src/os/file_posix.go index 0dc6da0908..f34571d68d 100644 --- a/src/os/file_posix.go +++ b/src/os/file_posix.go @@ -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 {