diff --git a/gitdiff/io.go b/gitdiff/io.go index d6e1fa8..eec120a 100644 --- a/gitdiff/io.go +++ b/gitdiff/io.go @@ -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) }