]> Cypherpunks repositories - gostls13.git/commitdiff
os: document that File.Seek works on directories, but not portably
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 6 Jan 2020 16:30:48 +0000 (16:30 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 6 Jan 2020 19:03:05 +0000 (19:03 +0000)
Updates #36019

Change-Id: I9fea2c3c5138e2233290979e4724f6e7b91da652
Reviewed-on: https://go-review.googlesource.com/c/go/+/213439
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/file.go

index 7995de79bfc20ba3aa7fe9e156344eb2590d8689..9f8c82718bb60c6ba72d4959643edc2160b41ea7 100644 (file)
@@ -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