Skip to content

os: Improve File.Seek documentation #6978

@bamiaux

Description

@bamiaux
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions