mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
fmt and reflect updates for recent changes
TBR=r OCL=21580 CL=21583
This commit is contained in:
parent
dc7b2e98d2
commit
ba882f9940
7 changed files with 58 additions and 59 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue