• Rob Pike's avatar
    fmt: allow any type in a format's width argument · a00cec90
    Rob Pike authored
    The construction
    	fmt.Printf("%*d", n, 4)
    reads the argument n as a width specifier to use when printing 4.
    Until now, only strict int type was accepted here and it couldn't
    be fixed because the fix, using reflection, broke escape analysis
    and added an extra allocation in every Printf call, even those that
    do not use this feature.
    
    The compiler has been fixed, although I am not sure when exactly,
    so let's fix Printf and then write
    
    Fixes #10732.
    
    Change-Id: I79cf0c4fadd876265aa39d3cb62867247b36ab65
    Reviewed-on: https://go-review.googlesource.com/14491Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    a00cec90
print.go 31 KB