Skip to content

Commit 6b1a3f7

Browse files
committed
os: document that File.Seek works on directories, but not portably
Updates #36019 Change-Id: I9fea2c3c5138e2233290979e4724f6e7b91da652 Reviewed-on: https://go-review.googlesource.com/c/go/+/213439 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent d6bf2d7 commit 6b1a3f7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/os/file.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) {
204204
// relative to the current offset, and 2 means relative to the end.
205205
// It returns the new offset and an error, if any.
206206
// The behavior of Seek on a file opened with O_APPEND is not specified.
207+
//
208+
// If f is a directory, the behavior of Seek varies by operating
209+
// system; you can seek to the beginning of the directory on Unix-like
210+
// operating systems, but not on Windows.
207211
func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
208212
if err := f.checkValid("seek"); err != nil {
209213
return 0, err

0 commit comments

Comments
 (0)