• Michael T. Jones's avatar
    fmt: handle precision 0 format stings in standard way · 8cdee891
    Michael T. Jones authored
    The C-stdlib heritage of printf/fprintf/sprintf has two odd
    aspects for precisions of zero with integers. First, the zero
    can be specified in any of these ways, "%4.0d", "%.0d" and
    "%.d" which was not previously supported here. Secondly, the
    seemingly universal interpretation of precision for integers
    is that precision==0 and value==0 means print nothing at all.
    The code here now handles this for integers just as the code
    in big/int.c does the same for the Int type. New tests are
    added to fmt_test.go to verify these changes.
    
    R=r, r
    CC=golang-dev
    https://golang.org/cl/4717045
    8cdee891
format.go 9.57 KB