Skip to content

Commit 5681704

Browse files
committed
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 8692bac commit 5681704

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/os/file_plan9.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
139139

140140
// Close closes the File, rendering it unusable for I/O.
141141
// On files that support SetDeadline, any pending I/O operations will
142-
// be canceled and return immediately with an error.
142+
// be canceled and return immediately with an ErrClosed error.
143143
// Close will return an error if it has already been called.
144144
func (f *File) Close() error {
145145
if err := f.checkValid("close"); err != nil {

src/os/file_posix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func sigpipe() // implemented in package runtime
1616

1717
// Close closes the File, rendering it unusable for I/O.
1818
// On files that support SetDeadline, any pending I/O operations will
19-
// be canceled and return immediately with an error.
19+
// be canceled and return immediately with an ErrClosed error.
2020
// Close will return an error if it has already been called.
2121
func (f *File) Close() error {
2222
if f == nil {

0 commit comments

Comments
 (0)