]> Cypherpunks repositories - gostls13.git/commitdiff
Update fmt, refl, and rpc to exploit bug fixes in compiler
authorRob Pike <r@golang.org>
Thu, 4 Sep 2008 17:39:04 +0000 (10:39 -0700)
committerRob Pike <r@golang.org>
Thu, 4 Sep 2008 17:39:04 +0000 (10:39 -0700)
R=gri
OCL=14806
CL=14806

src/lib/fmt.go

index d68d9dbf238abdee0b7dc180584781798117719e..9099a1630691e8b8fb202f2a55e0ee174da47dae 100644 (file)
@@ -112,14 +112,14 @@ func (f *Fmt) pad(s string) {
                        if w > NByte {
                                w = NByte;
                        }
-                       var buf[NByte] byte;  // BUG: should be able to allocate variable size
+                       buf := new([]byte, w);
                        for i := 0; i < w; i++ {
                                buf[i] = ' ';
                        }
                        if left {
-                               s = string(buf)[0:w] + s;
+                               s = string(buf) + s;
                        } else {
-                               s = s + string(buf)[0:w];
+                               s = s + string(buf);
                        }
                }
        }