1
0
mirror of https://github.com/golang/go synced 2024-11-08 18:46:16 -07:00
go/src/encoding
Russ Cox d0ce197c58 encoding/hex: make Decode, Decoder, DecodeString agree about partial results and errors
CL 70210 added Decoder for #21590, and in doing so it changed
the existing func Decode to return partial results for decoding errors.
That seems like a good change to make to Decode, but it was
untested (except as used by Decoder), inconsistent with DecodeString
in all error cases, and inconsistent with Decoder in not returning
partial results for odd-length input strings.

This CL makes Decode, DecodeString, and Decoder all agree about
the handling of partial results (they are returned) and error
precedence (the error earliest in the input is reported),
and it documents and tests this.

Change-Id: Ifb7d1e100ecb66fe2ed5ba34a621084d480f16db
Reviewed-on: https://go-review.googlesource.com/78120
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-16 01:08:20 +00:00
..
ascii85
asn1 encoding/asn1: add MarshalWithParams 2017-11-16 00:37:47 +00:00
base32 go/printer: forbid empty line before first comment in block 2017-11-02 18:17:22 +00:00
base64 encoding/base64: optimize DecodeString 2017-10-09 15:39:51 +00:00
binary encoding/binary: make new example a bit more idiomatic 2017-11-15 21:26:43 +00:00
csv encoding/csv: rename ParseError.RecordLine to .StartLine 2017-11-15 21:26:52 +00:00
gob encoding/gob: fix a typo in the package documentation 2017-10-08 18:11:32 +00:00
hex encoding/hex: make Decode, Decoder, DecodeString agree about partial results and errors 2017-11-16 01:08:20 +00:00
json encoding/json: always ignore embedded pointers to unexported struct types 2017-11-13 18:23:38 +00:00
pem encoding/pem: add Encode example 2017-11-15 03:08:55 +00:00
xml encoding/xml: move unexported const out of exported const block 2017-11-15 21:27:07 +00:00
encoding.go