diff options
Diffstat (limited to 'formats/pktline')
-rw-r--r-- | formats/pktline/decoder.go | 7 | ||||
-rw-r--r-- | formats/pktline/doc.go | 4 | ||||
-rw-r--r-- | formats/pktline/encoder.go | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/formats/pktline/decoder.go b/formats/pktline/decoder.go index c30be6b..34e6f51 100644 --- a/formats/pktline/decoder.go +++ b/formats/pktline/decoder.go @@ -7,9 +7,12 @@ import ( ) var ( - ErrUnderflow = errors.New("unexpected string length (underflow)") + // ErrUnderflow is triggered when a line is shorter than the described length + ErrUnderflow = errors.New("unexpected string length (underflow)") + // ErrInvalidHeader invalid pktline header ErrInvalidHeader = errors.New("invalid header") - ErrInvalidLen = errors.New("invalid length") + // ErrInvalidLen ivanlid line length found, < 0 + ErrInvalidLen = errors.New("invalid length") ) // Decoder implements a pkt-line format decoder diff --git a/formats/pktline/doc.go b/formats/pktline/doc.go index 0ae22e3..555a073 100644 --- a/formats/pktline/doc.go +++ b/formats/pktline/doc.go @@ -51,6 +51,8 @@ package pktline // https://github.com/git/git/blob/master/Documentation/technical/protocol-common.txt const ( + // HeaderLength length of the pktline header HeaderLength = 4 - MaxLength = 65524 + // MaxLength max line length + MaxLength = 65524 ) diff --git a/formats/pktline/encoder.go b/formats/pktline/encoder.go index dfa53e2..18efa25 100644 --- a/formats/pktline/encoder.go +++ b/formats/pktline/encoder.go @@ -7,6 +7,7 @@ import ( ) var ( + //ErrOverflow is triggered when the line length exceed the MaxLength ErrOverflow = errors.New("unexpected string length (overflow)") ) |