]> Cypherpunks repositories - gostls13.git/commit
fmt: empty byte slices should print nothing in hex
authorRob Pike <r@golang.org>
Mon, 13 Apr 2015 19:41:11 +0000 (12:41 -0700)
committerRob Pike <r@golang.org>
Mon, 13 Apr 2015 20:50:13 +0000 (20:50 +0000)
commit57058327c837fbfe64f2c4e4422b82a25c123eda
treeec7a5ea5661ab6311d7a678d9148b05040d718a6
parent63cced7b31efadb08dc0504958579b3d030e874e
fmt: empty byte slices should print nothing in hex

The documentation is clear that formats like %02x applied to a
byte slice are per-element, so the result should be nothing if the
slice is empty. It's not, because the top-level padding routine is called.
It shouldn't be: the loop does the padding for us.

Fixes #10430.

Change-Id: I04ea0e804c0f2e70fff3701e5bf22acc90e890da
Reviewed-on: https://go-review.googlesource.com/8864
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/fmt/fmt_test.go
src/fmt/format.go