-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fmt: handle negative width/prec when supplied as an argument
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/11405 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Rob Pike <r@golang.org>
- Loading branch information
Showing
2 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters