mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[] 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:
parent
33907d1346
commit
c3077f7606
15 changed files with 246 additions and 170 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue