]> Cypherpunks repositories - gostls13.git/commit
os: more descriptive error for File.ReadAt and File.WriteAt with negative offset.
authorGeorge Gkirtsou <ggirtsou@gmail.com>
Sun, 9 Apr 2017 20:12:39 +0000 (21:12 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 10 Apr 2017 18:16:44 +0000 (18:16 +0000)
commita5999b7b81b9dc875cc635e1b089d768ddd41a8c
tree182a9144a9ab1119fa8f45dd9697a41eb5bb97b4
parent26c2926f648cafdbd09954495242a67eedb631b4
os: more descriptive error for File.ReadAt and File.WriteAt with negative offset.

The existing implementation does not provide a useful error message
if a negative offset is passed in File.ReadAt or File.WriteAt. This
change is to return descriptive errors. An error of type *PathError
is returned to keep it consistent with rest of the code.

There is no need to add an exported error variable since it's used only
in one file.

Fixes #19031

Change-Id: Ib94cab0afae8c5fe4dd97ed2887018a09b9f4538
Reviewed-on: https://go-review.googlesource.com/39136
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/os/file.go
src/os/os_test.go