From: Rob Pike Date: Thu, 4 Sep 2008 17:39:04 +0000 (-0700) Subject: Update fmt, refl, and rpc to exploit bug fixes in compiler X-Git-Tag: weekly.2009-11-06~3278 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4c9d84f06a2a7aa5978c62636519e6e2bec14112;p=gostls13.git Update fmt, refl, and rpc to exploit bug fixes in compiler R=gri OCL=14806 CL=14806 --- diff --git a/src/lib/fmt.go b/src/lib/fmt.go index d68d9dbf23..9099a16306 100644 --- a/src/lib/fmt.go +++ b/src/lib/fmt.go @@ -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); } } }