• Martin Möhrmann's avatar
    fmt: unify array and slice formatting for bytes and other types · 9149aa10
    Martin Möhrmann authored
    Make verbs b,c,o and U work for any array and slice of integer
    type including byte and uint8.
    
    Fix a bug that triggers badverb for []uint8 and []byte type
    on the slice/array level instead of on each element like for
    any other slice or array type.
    
    Add tests that make sure we do not accidentally alter the
    behavior of printing []byte for []byte and []uint8 type
    if they are used at the top level when formatting with %#v.
    
    name               old time/op  new time/op  delta
    SprintfHexBytes-2   177ns ± 2%   176ns ± 2%   ~     (p=0.066 n=48+49)
    SprintfBytes-2      330ns ± 1%   329ns ± 1%   ~     (p=0.118 n=45+47)
    
    Fixes #13478
    
    Change-Id: I99328a184973ae219bcc0f69c3978cb1ff462888
    Reviewed-on: https://go-review.googlesource.com/20686
    Run-TryBot: Rob Pike <r@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    9149aa10
Name
Last commit
Last update
..
doc.go Loading commit data...
export_test.go Loading commit data...
fmt_test.go Loading commit data...
format.go Loading commit data...
print.go Loading commit data...
scan.go Loading commit data...
scan_test.go Loading commit data...
stringer_test.go Loading commit data...