diff options
| author | Oleksandr Redko <oleksandr.red+github@gmail.com> | 2023-02-12 15:37:00 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-02-16 23:09:19 +0000 |
| commit | 3ad6393f8676b1b408673bf40b8a876f29561eef (patch) | |
| tree | 7338eaf302fd64d9d24e9776999a919e87c71778 /src/encoding/binary/varint.go | |
| parent | 135c470b2277e1c9514ba8a5478408fea0dee8a2 (diff) | |
| download | go-3ad6393f8676b1b408673bf40b8a876f29561eef.tar.xz | |
src: rename unexported errors by adding prefix err
By convention, use `err` as prefix for variables of type `error`.
Change-Id: I9401d5d47e994a27be245b2c8b1edd55cdd52db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/467536
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/encoding/binary/varint.go')
| -rw-r--r-- | src/encoding/binary/varint.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/encoding/binary/varint.go b/src/encoding/binary/varint.go index 18e1ff1511..7b14fb2b63 100644 --- a/src/encoding/binary/varint.go +++ b/src/encoding/binary/varint.go @@ -123,7 +123,7 @@ func Varint(buf []byte) (int64, int) { return x, n } -var overflow = errors.New("binary: varint overflows a 64-bit integer") +var errOverflow = errors.New("binary: varint overflows a 64-bit integer") // ReadUvarint reads an encoded unsigned integer from r and returns it as a uint64. // The error is EOF only if no bytes were read. @@ -142,14 +142,14 @@ func ReadUvarint(r io.ByteReader) (uint64, error) { } if b < 0x80 { if i == MaxVarintLen64-1 && b > 1 { - return x, overflow + return x, errOverflow } return x | uint64(b)<<s, nil } x |= uint64(b&0x7f) << s s += 7 } - return x, overflow + return x, errOverflow } // ReadVarint reads an encoded signed integer from r and returns it as an int64. |
