mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
cmd/internal/cov: use io.SeekStart, io.SeekCurrent, and io.SeekEnd
Change-Id: Ibf7e33e42c649783eaa0e638babff22d96ab51c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/436701 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
fdcaae5734
commit
d547ae2a8e
|
@ -72,12 +72,12 @@ func (r *MReader) Seek(offset int64, whence int) (int64, error) {
|
|||
return r.rdr.MustSeek(offset, whence), nil
|
||||
}
|
||||
switch whence {
|
||||
case os.SEEK_SET:
|
||||
case io.SeekStart:
|
||||
r.off = offset
|
||||
return offset, nil
|
||||
case os.SEEK_CUR:
|
||||
case io.SeekCurrent:
|
||||
return r.off, nil
|
||||
case os.SEEK_END:
|
||||
case io.SeekEnd:
|
||||
r.off = int64(len(r.fileView)) + offset
|
||||
return r.off, nil
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"internal/coverage/decodecounter"
|
||||
"internal/coverage/decodemeta"
|
||||
"internal/coverage/pods"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
@ -191,7 +192,7 @@ func (r *CovDataReader) visitPod(p pods.Pod) error {
|
|||
return r.fatal("unable to stat metafile %s: %v", p.MetaFile, err)
|
||||
}
|
||||
fileView := br.SliceRO(uint64(fi.Size()))
|
||||
br.MustSeek(0, os.SEEK_SET)
|
||||
br.MustSeek(0, io.SeekStart)
|
||||
|
||||
r.verb(1, "fileView for pod is length %d", len(fileView))
|
||||
|
||||
|
|
Loading…
Reference in a new issue