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

io: define SeekStart, SeekCurrent, SeekEnd constants for use with Seeker #6885

Closed
minux opened this issue Dec 3, 2013 · 7 comments
Closed
Milestone

Comments

@minux
Copy link
Member

minux commented Dec 3, 2013

see issue #6873, and https://golang.org/cl/36810043/.

> We already have these in pkg/os, also with this TERRIBLE_CASE. Let's stop the
bleeding.
> In Go 2 we could move them and fix the case or maybe even change the signature to
not be so C-like.
@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 1:

Labels changed: added repo-main.

@nightlyone
Copy link
Contributor

Comment 2:

The actual use cases for seek are more along the lines of skipping bytes in a stream,
determining the size of a stream, rewinding a stream to the beginning, going to the end
and start using a io.Reader or io.Writer from a specific position. 
None of these require actual random access and thus still can be supported by compressed
streams.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 3:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

@minux minux added accepted v2 A language change or incompatible library change labels Mar 3, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@extemporalgenome
Copy link
Contributor

Could we just duplicate those three "whence" consts into io, with properly cased names? (i.e. io.SeekEnd)

@nightlyone Size() int64 is a method that shows up occasionally, and its semantics are consistent across implementations. Instead of having separate methods for rewind and such, why not just use the existing interface, but have no-random-access implementations return errors on seeks they don't support?

@rsc rsc changed the title io: rethink Seeker interface, move required consts from os io: define SeekStart, SeekCurrent, SeekEnd constants for use with Seeker Jan 4, 2016
@rsc rsc removed the v2 A language change or incompatible library change label Jan 4, 2016
@rsc rsc modified the milestones: Go1.7, Unplanned Jan 4, 2016
@rsc
Copy link
Contributor

rsc commented Jan 4, 2016

I like @extemporalgenome's suggestion. Maybe for Go 1.7.

@gopherbot
Copy link

CL https://golang.org/cl/19862 mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 5, 2016
CL/19862 introduced the same set of constants to the io package.
We should steer users away from the os.SEEK* versions and towards
the io.Seek* versions.

Updates golang#6885

Change-Id: I96ec5be3ec3439e1295c937159dadaf1ebfb2737
Reviewed-on: https://go-review.googlesource.com/21540
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/23551 mentions this issue.

gopherbot pushed a commit that referenced this issue May 29, 2016
The documentation previously used C style enumerations: 0, 1, 2.
While this is pretty much universally correct, it does not help a user
become aware of the existence of the SeekStart, SeekCurrent, and SeekEnd
constants. Thus, we should use them in the documentation to direct people's
attention to them.

Updates #6885

Change-Id: I44b5e78d41601c68a0a1c96428c853df53981d52
Reviewed-on: https://go-review.googlesource.com/23551
Reviewed-by: Andrew Gerrand <adg@golang.org>
@golang golang locked and limited conversation to collaborators May 28, 2017
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

5 participants