aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-06-24 12:54:26 -0700
committerRob Pike <r@golang.org>2008-06-24 12:54:26 -0700
commit362ea7c77da8afef44a6f762a2b1ccd2d4841667 (patch)
treea3b7821dac023d0c93749af445d005f3bc2d0887 /src
parent90846cd447bfc8fd231041daddee58998c3e7ad7 (diff)
downloadgo-362ea7c77da8afef44a6f762a2b1ccd2d4841667.tar.xz
remove explicit import of "sys"
add a boolean printer SVN=124362
Diffstat (limited to 'src')
-rw-r--r--src/lib/fmt.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/fmt.go b/src/lib/fmt.go
index 8c4b249626..521e8ed02c 100644
--- a/src/lib/fmt.go
+++ b/src/lib/fmt.go
@@ -11,7 +11,7 @@ package fmt
f.ud(^0).putnl(); // print string with automatic newline
*/
-import sys "sys"
+// import sys "sys"
export Fmt, New;
@@ -144,6 +144,17 @@ func putint(buf *[64]byte, i int, base, val uint64, digits *string) int {
return i-1;
}
+// boolean
+func (f *Fmt) boolean(a bool) *Fmt {
+ if a {
+ f.pad("true");
+ } else {
+ f.pad("false");
+ }
+ f.clearflags();
+ return f;
+}
+
// integer; interprets prec but not wid.
func (f *Fmt) integer(a int64, base uint, is_signed bool, digits *string) string {
var buf [64]byte;