• Todd Neal's avatar
    fmt: handle negative width/prec when supplied as an argument · 4e834cff
    Todd Neal authored
    Negative width arguments now left align the way a minus-width in the
    format string aligns. The minus in the format string overrides the sign
    of the argument as in C.
    
    Precision behavior is modified to include an error if the argument is
    negative.  This differs from a negative precision in a format string
    which just terminates the format.
    
    Additional checks for large magnitude widths and precisions are added to
    make the runtime behavior (failure, but with different error messages),
    more consistent between format string specified width/precision and
    argument specified width/precision.
    
    Fixes #11376
    
    Change-Id: I8c7ed21088e9c18128a45d4c487c5ab9fafd13ef
    Reviewed-on: https://go-review.googlesource.com/11405Reviewed-by: 's avatarRob Pike <r@golang.org>
    Run-TryBot: Rob Pike <r@golang.org>
    4e834cff
print.go 30.5 KB