From: Brad Fitzpatrick Date: Mon, 6 Jan 2020 16:30:48 +0000 (+0000) Subject: os: document that File.Seek works on directories, but not portably X-Git-Tag: go1.14rc1~160 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6b1a3f73ed6fb1ea2a65cf9eb78cbe972bda43a7;p=gostls13.git 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 --- diff --git a/src/os/file.go b/src/os/file.go index 7995de79bf..9f8c82718b 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -204,6 +204,10 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) { // relative to the current offset, and 2 means relative to the end. // It returns the new offset and an error, if any. // The behavior of Seek on a file opened with O_APPEND is not specified. +// +// If f is a directory, the behavior of Seek varies by operating +// system; you can seek to the beginning of the directory on Unix-like +// operating systems, but not on Windows. func (f *File) Seek(offset int64, whence int) (ret int64, err error) { if err := f.checkValid("seek"); err != nil { return 0, err