diff --git a/internal/wire/common.go b/internal/wire/common.go index 6446ed7d..f4c61e28 100644 --- a/internal/wire/common.go +++ b/internal/wire/common.go @@ -490,10 +490,10 @@ func ReadVarInt(r io.Reader, _ uint32) (uint64, error) { // The encoding is not canonical if the value could have been // encoded using fewer bytes. - min := uint64(0x100000000) - if rv < min { + minValue := uint64(0x100000000) + if rv < minValue { return 0, messageError("ReadVarInt", fmt.Sprintf( - errNonCanonicalVarInt, rv, discriminant, min)) + errNonCanonicalVarInt, rv, discriminant, minValue)) } case 0xfe: @@ -505,10 +505,10 @@ func ReadVarInt(r io.Reader, _ uint32) (uint64, error) { // The encoding is not canonical if the value could have been // encoded using fewer bytes. - min := uint64(0x10000) - if rv < min { + minValue := uint64(0x10000) + if rv < minValue { return 0, messageError("ReadVarInt", fmt.Sprintf( - errNonCanonicalVarInt, rv, discriminant, min)) + errNonCanonicalVarInt, rv, discriminant, minValue)) } case 0xfd: @@ -520,10 +520,10 @@ func ReadVarInt(r io.Reader, _ uint32) (uint64, error) { // The encoding is not canonical if the value could have been // encoded using fewer bytes. - min := uint64(0xfd) - if rv < min { + minValue := uint64(0xfd) + if rv < minValue { return 0, messageError("ReadVarInt", fmt.Sprintf( - errNonCanonicalVarInt, rv, discriminant, min)) + errNonCanonicalVarInt, rv, discriminant, minValue)) } default: diff --git a/internal/wire/fixedIO_test.go b/internal/wire/fixedIO_test.go index 731c4638..552b876f 100644 --- a/internal/wire/fixedIO_test.go +++ b/internal/wire/fixedIO_test.go @@ -37,9 +37,9 @@ func (w *fixedWriter) Bytes() []byte { } // newFixedWriter returns a new io.Writer that will error once more bytes than -// the specified max have been written. -func newFixedWriter(max int) io.Writer { - b := make([]byte, max) +// the specified maxBytes have been written. +func newFixedWriter(maxBytes int) io.Writer { + b := make([]byte, maxBytes) fw := fixedWriter{b, 0} return &fw } @@ -64,9 +64,9 @@ func (fr *fixedReader) Read(p []byte) (n int, err error) { } // newFixedReader returns a new io.Reader that will error once more bytes than -// the specified max have been read. -func newFixedReader(max int, buf []byte) io.Reader { - b := make([]byte, max) +// the specified maxBytes have been read. +func newFixedReader(maxBytes int, buf []byte) io.Reader { + b := make([]byte, maxBytes) if buf != nil { copy(b[:], buf) }