From: Joe Tsai Date: Thu, 1 Oct 2015 22:09:11 +0000 (-0700) Subject: io: clarify documentation for Seeker X-Git-Tag: go1.6beta1~906 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dbc7203d22e782275c1cad6840b235a0bcf83288;p=gostls13.git io: clarify documentation for Seeker The later part of the docstring simply talks about "offset" but does not disambiguate what it is relative to. For both the return value and valid offsets to seek to, it only makes sense in the context of "offset relative to origin of file". Fixes #11877 Change-Id: Ic238a407cf8e8fdd64991d98a6584cdc8a51cd6b Reviewed-on: https://go-review.googlesource.com/15257 Reviewed-by: Andrew Gerrand --- diff --git a/src/io/io.go b/src/io/io.go index 8851eaf00a..5a8889363a 100644 --- a/src/io/io.go +++ b/src/io/io.go @@ -95,14 +95,14 @@ type Closer interface { // Seeker is the interface that wraps the basic Seek method. // // Seek sets the offset for the next Read or Write to offset, -// interpreted according to whence: 0 means relative to the origin of +// interpreted according to whence: 0 means relative to the start of // the file, 1 means relative to the current offset, and 2 means -// relative to the end. Seek returns the new offset and an error, if -// any. +// relative to the end. Seek returns the new offset relative to the +// start of the file and an error, if any. // -// Seeking to a negative offset is an error. Seeking to any positive -// offset is legal, but the behavior of subsequent I/O operations on -// the underlying object is implementation-dependent. +// Seeking to an offset before the start of the file is an error. +// Seeking to any positive offset is legal, but the behavior of subsequent +// I/O operations on the underlying object is implementation-dependent. type Seeker interface { Seek(offset int64, whence int) (int64, error) }