Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: Improve File.Seek documentation #6978

Closed
bamiaux opened this issue Dec 17, 2013 · 3 comments
Closed

os: Improve File.Seek documentation #6978

bamiaux opened this issue Dec 17, 2013 · 3 comments

Comments

@bamiaux
Copy link

bamiaux commented Dec 17, 2013

Currently, the documentation on os.File.Seek mentions:

Seek sets the offset for the next Read or Write on file to offset, interpreted according
to whence: 0 means relative to the origin of the file, 1 means relative to the current
offset, and 2 means relative to the end.

It leads people to write things like file.Seek(0, 2) which is in my opinion, not that
readable, especially when you don't know where those numbers come from.

I believe it would be better if the following os constants were mentioned instead:
 * SEEK_SET
 * SEEK_CUR
 * SEEK_END
@gopherbot
Copy link

Comment 1 by islandberry23:

See https://golang.org/issue/6873

@robpike
Copy link
Contributor

robpike commented Dec 17, 2013

Comment 2:

Status changed to Duplicate.

Merged into issue #6873.

@dominikh
Copy link
Member

Comment 3:

This isn't precisely a duplicate. issue #6873 is concerned with moving the constants
around, this issue merely suggests making the existing ones more visible.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants