]> Cypherpunks repositories - gostls13.git/commitdiff
remove explicit import of "sys"
authorRob Pike <r@golang.org>
Tue, 24 Jun 2008 19:54:26 +0000 (12:54 -0700)
committerRob Pike <r@golang.org>
Tue, 24 Jun 2008 19:54:26 +0000 (12:54 -0700)
add a boolean printer

SVN=124362

src/lib/fmt.go

index 8c4b24962634740afcb1460be79c040e446a2f10..521e8ed02c3f34df3ab9418223a1c5e73819c7b6 100644 (file)
@@ -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;