fix golint issues in core/filex (#485)

This commit is contained in:
Kevin Wan
2021-02-19 14:30:38 +08:00
committed by GitHub
parent 802549ac7c
commit c376ffc351
5 changed files with 22 additions and 11 deletions

View File

@@ -5,12 +5,14 @@ import (
"os"
)
// A RangeReader is used to read a range of content from a file.
type RangeReader struct {
file *os.File
start int64
stop int64
}
// NewRangeReader returns a RangeReader, which will read the range of content from file.
func NewRangeReader(file *os.File, start, stop int64) *RangeReader {
return &RangeReader{
file: file,
@@ -19,6 +21,7 @@ func NewRangeReader(file *os.File, start, stop int64) *RangeReader {
}
}
// Read reads the range of content into p.
func (rr *RangeReader) Read(p []byte) (n int, err error) {
stat, err := rr.file.Stat()
if err != nil {