]> Cypherpunks repositories - gostls13.git/commitdiff
io: clarify documentation for Seeker
authorJoe Tsai <joetsai@digital-static.net>
Thu, 1 Oct 2015 22:09:11 +0000 (15:09 -0700)
committerAndrew Gerrand <adg@golang.org>
Tue, 6 Oct 2015 02:06:40 +0000 (02:06 +0000)
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 <adg@golang.org>
src/io/io.go

index 8851eaf00ab38368c10e9c0ebe1e890add3b463f..5a8889363a3c44b7195208b15b274f7948f407c9 100644 (file)
@@ -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)
 }