Skip to content
Snippets Groups Projects
Commit 6b1a3f73 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick
Browse files

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: default avatarIan Lance Taylor <iant@golang.org>
parent d6bf2d7b
No related branches found
No related tags found
No related merge requests found
...@@ -204,6 +204,10 @@ func (f *File) WriteAt(b []byte, off int64) (n int, err error) { ...@@ -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. // relative to the current offset, and 2 means relative to the end.
// It returns the new offset and an error, if any. // It returns the new offset and an error, if any.
// The behavior of Seek on a file opened with O_APPEND is not specified. // 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) { func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
if err := f.checkValid("seek"); err != nil { if err := f.checkValid("seek"); err != nil {
return 0, err return 0, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment