@@ -124,7 +124,7 @@ func (r *Reader) ReadLine() ([]byte, error) {
124124 return line , nil
125125}
126126
127- // readLine that returns an error if:
127+ // readLine returns an error if:
128128// - there is a pending read error;
129129// - or line does not end with \r\n.
130130func (r * Reader ) readLine () ([]byte , error ) {
@@ -403,7 +403,7 @@ func (r *Reader) ReadArrayLen() (int, error) {
403403 case RespArray , RespSet , RespPush :
404404 return replyLen (line )
405405 default :
406- return 0 , fmt .Errorf ("redis: can't parse array(array /set/push) reply: %.100q" , line )
406+ return 0 , fmt .Errorf ("redis: can't parse array/set/push reply: %.100q" , line )
407407 }
408408}
409409
@@ -446,6 +446,15 @@ func (r *Reader) ReadMapLen() (int, error) {
446446 }
447447}
448448
449+ // DiscardNext read and discard the data represented by the next line.
450+ func (r * Reader ) DiscardNext () error {
451+ line , err := r .readLine ()
452+ if err != nil {
453+ return err
454+ }
455+ return r .Discard (line )
456+ }
457+
449458// Discard the data represented by line.
450459func (r * Reader ) Discard (line []byte ) (err error ) {
451460 if len (line ) == 0 {
@@ -486,15 +495,6 @@ func (r *Reader) Discard(line []byte) (err error) {
486495 return fmt .Errorf ("redis: can't parse %.100q" , line )
487496}
488497
489- // DiscardNext read and discard the data represented by the next line.
490- func (r * Reader ) DiscardNext () error {
491- line , err := r .readLine ()
492- if err != nil {
493- return err
494- }
495- return r .Discard (line )
496- }
497-
498498func replyLen (line []byte ) (n int , err error ) {
499499 n , err = util .Atoi (line [1 :])
500500 if err != nil {
@@ -515,7 +515,7 @@ func replyLen(line []byte) (n int, err error) {
515515 return n , nil
516516}
517517
518- // IsNilReply detect redis.Nil of RESP2.
518+ // IsNilReply detects redis.Nil of RESP2.
519519func IsNilReply (line []byte ) bool {
520520 return len (line ) == 3 &&
521521 (line [0 ] == RespString || line [0 ] == RespArray ) &&
0 commit comments