io/fs: document when ErrClosed should be returned

Pull ErrClosed out of the grouped var declaration so it can have its
own doc comment explaining that file system implementations should
return it when operations are attempted on a closed file.

Fixes #63918

Change-Id: I1fe2041c594ad6fd37e240e21fe9b3d4104daa46
Reviewed-on: https://go-review.googlesource.com/c/go/+/741446
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
kovan
2026-02-17 02:26:33 +01:00
committed by Gopher Robot
parent 8da2be3cd0
commit 703cc8abec

View File

@@ -155,9 +155,12 @@ var (
ErrPermission = errPermission() // "permission denied"
ErrExist = errExist() // "file already exists"
ErrNotExist = errNotExist() // "file does not exist"
ErrClosed = errClosed() // "file already closed"
)
// ErrClosed is returned when operations are attempted on a file that
// has already been closed, including when Close is called more than once.
var ErrClosed = errClosed()
func errInvalid() error { return oserror.ErrInvalid }
func errPermission() error { return oserror.ErrPermission }
func errExist() error { return oserror.ErrExist }