fix golint issues in core/iox (#488)

This commit is contained in:
Kevin Wan
2021-02-19 18:40:26 +08:00
committed by GitHub
parent 0c094cb2d7
commit 1f92bfde6a
5 changed files with 17 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
)
// A TextLineScanner is a scanner that can scan lines from given reader.
type TextLineScanner struct {
reader *bufio.Reader
hasNext bool
@@ -13,6 +14,7 @@ type TextLineScanner struct {
err error
}
// NewTextLineScanner returns a TextLineScanner with given reader.
func NewTextLineScanner(reader io.Reader) *TextLineScanner {
return &TextLineScanner{
reader: bufio.NewReader(reader),
@@ -20,6 +22,7 @@ func NewTextLineScanner(reader io.Reader) *TextLineScanner {
}
}
// Scan checks if scanner has more lines to read.
func (scanner *TextLineScanner) Scan() bool {
if !scanner.hasNext {
return false
@@ -37,6 +40,7 @@ func (scanner *TextLineScanner) Scan() bool {
return true
}
// Line returns the next available line.
func (scanner *TextLineScanner) Line() (string, error) {
return scanner.line, scanner.err
}