summaryrefslogtreecommitdiff
path: root/src/pkg/fmt/format.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-09 21:13:17 -0800
committerRobert Griesemer <gri@golang.org>2009-11-09 21:13:17 -0800
commit073e240233589933c43143c997247c33206bb066 (patch)
treee6953aa6ac9f97ad730c7509a39cf15d82131fab /src/pkg/fmt/format.go
parentef50a171462c00444b6bf8d205ae8e97079ab2b9 (diff)
downloadgolang-073e240233589933c43143c997247c33206bb066.tar.gz
- replaced gofmt expression formatting algorithm with
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1026036
Diffstat (limited to 'src/pkg/fmt/format.go')
-rw-r--r--src/pkg/fmt/format.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/fmt/format.go b/src/pkg/fmt/format.go
index 79817bfd4..8407fbe0b 100644
--- a/src/pkg/fmt/format.go
+++ b/src/pkg/fmt/format.go
@@ -138,9 +138,9 @@ func (f *Fmt) pad(s string) {
buf[i] = padchar
}
if left {
- s = string(buf)+s
+ s = string(buf) + s
} else {
- s = s+string(buf)
+ s = s + string(buf)
}
}
}
@@ -153,14 +153,14 @@ func (f *Fmt) pad(s string) {
// marginally faster by splitting the 32-bit case out into a separate function
// but it's not worth the duplication, so val has 64 bits.
func putint(buf []byte, base, val uint64, digits string) int {
- i := len(buf)-1;
+ i := len(buf) - 1;
for val >= base {
buf[i] = digits[val%base];
i--;
val /= base;
}
buf[i] = digits[val];
- return i-1;
+ return i - 1;
}
// Fmt_boolean formats a boolean.
@@ -209,7 +209,7 @@ func (f *Fmt) integer(a int64, base uint, is_signed bool, digits string) string
i--;
}
case 16:
- buf[i] = 'x'+digits[10]-'a';
+ buf[i] = 'x' + digits[10] - 'a';
i--;
buf[i] = '0';
i--;
@@ -357,7 +357,7 @@ func (f *Fmt) Fmt_c(v int) *Fmt {
func (f *Fmt) Fmt_s(s string) *Fmt {
if f.prec_present {
if f.prec < len(s) {
- s = s[0 : f.prec]
+ s = s[0:f.prec]
}
}
f.pad(s);
@@ -398,7 +398,7 @@ func (f *Fmt) Fmt_sX(s string) *Fmt {
func (f *Fmt) Fmt_q(s string) *Fmt {
var quoted string;
if f.sharp && strconv.CanBackquote(s) {
- quoted = "`"+s+"`"
+ quoted = "`" + s + "`"
} else {
quoted = strconv.Quote(s)
}