Skip to content

Commit 3ec1c74

Browse files
committed
Improve docs for StringReader and LineReader
Document the method as part of the type so it is processed by godoc.
1 parent a1f934e commit 3ec1c74

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

gitdiff/io.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ import (
66
)
77

88
// StringReader is the interface that wraps the ReadString method.
9+
//
10+
// ReadString reads until the first occurrence of delim in the input, returning
11+
// a string containing the data up to and including the delimiter. If
12+
// ReadString encounters an error before finding a delimiter, it returns the
13+
// data read before the error and the error itself (often io.EOF). ReadString
14+
// returns err != nil if and only if the returned data does not end in delim.
915
type StringReader interface {
10-
// ReadString reads until the first occurrence of delim in the input,
11-
// returning a string containing the data up to and including the
12-
// delimiter. If ReadString encounters an error before finding a delimiter,
13-
// it returns the data read before the error and the error itself (often
14-
// io.EOF). ReadString returns err != nil if and only if the returned data
15-
// does not end in delim.
1616
ReadString(delim byte) (string, error)
1717
}
1818

1919
// LineReader is the interface that wraps the ReadLine method.
20+
//
21+
// ReadLine reads the next full line in the input, returing the the data
22+
// including the line ending character(s) and the zero-indexed line number. If
23+
// ReadLine encounters an error before reaching the end of the line, it returns
24+
// the data read before the error and the error itself (often io.EOF). ReadLine
25+
// returns err != nil if and only if the returned data is not a complete line.
26+
//
27+
// If an implementation defines other methods for reading the same input, line
28+
// numbers may be incorrect if calls to ReadLine are mixed with calls to other
29+
// read methods.
2030
type LineReader interface {
21-
// ReadLine reads the next full line in the input, returing the the data
22-
// including the line ending character(s) and the zero-indexed line number.
23-
// If ReadLine encounters an error before reaching the end of the line, it
24-
// returns the data read before the error and the error itself (often
25-
// io.EOF). ReadLine returns err != nil if and only if the returned data is
26-
// not a complete line.
27-
//
28-
// If the implementation defines other methods for reading the same input,
29-
// line numbers may be incorrect if calls to ReadLine are mixed with calls
30-
// to other read methods.
3131
ReadLine() (string, int, error)
3232
}
3333

0 commit comments

Comments
 (0)