1
0
mirror of https://github.com/golang/go synced 2024-11-17 18:04:48 -07:00

io: remove manual SectionReader.Size in SectionReader.ReadAt

Change-Id: Ib3e8953dbdefa2b78c31b1bcbf0909bce248e423
Reviewed-on: https://go-review.googlesource.com/c/go/+/500475
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Jorropo 2023-06-02 20:20:18 +02:00 committed by Gopher Robot
parent 9fc3feb441
commit 460dc37c88

View File

@ -540,7 +540,7 @@ func (s *SectionReader) Seek(offset int64, whence int) (int64, error) {
}
func (s *SectionReader) ReadAt(p []byte, off int64) (n int, err error) {
if off < 0 || off >= s.limit-s.base {
if off < 0 || off >= s.Size() {
return 0, EOF
}
off += s.base