[] and struct in interfaces.

other [] cleanup.

convert() is gone.

R=r
DELTA=352  (144 added, 68 deleted, 140 changed)
OCL=21660
CL=21662
This commit is contained in:
Russ Cox 2008-12-19 17:11:54 -08:00
parent 33907d1346
commit c3077f7606
15 changed files with 246 additions and 170 deletions

View file

@ -253,12 +253,11 @@ 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;
case reflect.ArrayKind:
if val, ok := v.Interface().([]byte); ok {
return string(val), true;
}
}
// TODO(rsc): check for Interface().([]byte) too.
return "", false;
}