• Andrew Gerrand's avatar
    fmt: print byte stringers correctly · 326f48eb
    Andrew Gerrand authored
    type T byte
    func (T) String() string { return "X" }
    
    fmt.Sprintf("%s", []T{97, 98, 99, 100}) == "abcd"
    fmt.Sprintf("%x", []T{97, 98, 99, 100}) == "61626364"
    fmt.Sprintf("%v", []T{97, 98, 99, 100}) == "[X X X X]"
    
    This change makes the last case print correctly.
    Before, it would have been "[97 98 99 100]".
    
    Fixes #8360.
    
    LGTM=r
    R=r, dan.kortschak
    CC=golang-codereviews
    https://golang.org/cl/129330043
    326f48eb
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...