aboutsummaryrefslogtreecommitdiff
path: root/src/fmt/format.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/fmt/format.go')
-rw-r--r--src/fmt/format.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fmt/format.go b/src/fmt/format.go
index 099f8a5e00..ba984cf84f 100644
--- a/src/fmt/format.go
+++ b/src/fmt/format.go
@@ -163,7 +163,7 @@ func (f *fmt) integer(a int64, base uint64, signedness bool, digits string) {
}
var buf []byte = f.intbuf[0:]
- if f.widPresent || f.precPresent {
+ if f.widPresent || f.precPresent || f.plus || f.space {
width := f.wid + f.prec // Only one will be set, both are positive; this provides the maximum.
if base == 16 && f.sharp {
// Also adds "0x".
@@ -177,6 +177,11 @@ func (f *fmt) integer(a int64, base uint64, signedness bool, digits string) {
width += 1 + 1 + utf8.UTFMax + 1
}
}
+ if f.plus {
+ width++
+ } else if f.space {
+ width++
+ }
if width > nByte {
// We're going to need a bigger boat.
buf = make([]byte, width)