fmt and reflect updates for recent changes

TBR=r
OCL=21580
CL=21583
This commit is contained in:
Russ Cox 2008-12-19 03:06:19 -08:00
parent dc7b2e98d2
commit ba882f9940
7 changed files with 58 additions and 59 deletions

View file

@ -46,7 +46,7 @@ type P struct {
}
func Printer() *P {
p := new(P);
p := new(*P);
p.fmt = fmt.New();
return p;
}
@ -253,10 +253,12 @@ func getString(v reflect.Value) (val string, ok bool) {
switch v.Kind() {
case reflect.StringKind:
return v.(reflect.StringValue).Get(), true;
case reflect.PtrKind:
if val, ok := v.Interface().(*[]byte); ok {
return string(*val), true;
}
}
if valb, okb := v.Interface().([]byte); okb {
return string(valb), true;
}
// TODO(rsc): check for Interface().([]byte) too.
return "", false;
}