Improve docs for StringReader and LineReader

Document the method as part of the type so it is processed by godoc.
This commit is contained in:
Billy Keyes
2020-01-04 20:02:34 -08:00
parent a1f934e852
commit 3ec1c74c34
+16 -16
View File
@@ -6,28 +6,28 @@ import (
)
// StringReader is the interface that wraps the ReadString method.
//
// ReadString reads until the first occurrence of delim in the input, returning
// a string containing the data up to and including the delimiter. If
// ReadString encounters an error before finding a delimiter, it returns the
// data read before the error and the error itself (often io.EOF). ReadString
// returns err != nil if and only if the returned data does not end in delim.
type StringReader interface {
// ReadString reads until the first occurrence of delim in the input,
// returning a string containing the data up to and including the
// delimiter. If ReadString encounters an error before finding a delimiter,
// it returns the data read before the error and the error itself (often
// io.EOF). ReadString returns err != nil if and only if the returned data
// does not end in delim.
ReadString(delim byte) (string, error)
}
// LineReader is the interface that wraps the ReadLine method.
//
// ReadLine reads the next full line in the input, returing the the data
// including the line ending character(s) and the zero-indexed line number. If
// ReadLine encounters an error before reaching the end of the line, it returns
// the data read before the error and the error itself (often io.EOF). ReadLine
// returns err != nil if and only if the returned data is not a complete line.
//
// If an implementation defines other methods for reading the same input, line
// numbers may be incorrect if calls to ReadLine are mixed with calls to other
// read methods.
type LineReader interface {
// ReadLine reads the next full line in the input, returing the the data
// including the line ending character(s) and the zero-indexed line number.
// If ReadLine encounters an error before reaching the end of the line, it
// returns the data read before the error and the error itself (often
// io.EOF). ReadLine returns err != nil if and only if the returned data is
// not a complete line.
//
// If the implementation defines other methods for reading the same input,
// line numbers may be incorrect if calls to ReadLine are mixed with calls
// to other read methods.
ReadLine() (string, int, error)
}