clear flags so that %+v does not pass the +

to the first field it prints.

R=r
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=21324
CL=21328
This commit is contained in:
Russ Cox 2008-12-16 14:39:29 -08:00
parent a10267adcd
commit 67a7abad7f

View File

@ -386,7 +386,8 @@ func (p *P) printField(field reflect.Value) (was_string bool) {
p.add('{');
v := field.(reflect.StructValue);
t := v.Type().(reflect.StructType);
donames := p.fmt.plus; // first p.printField clears flag
donames := p.fmt.plus;
p.fmt.clearflags(); // clear flags for p.printField
for i := 0; i < v.Len(); i++ {
if i > 0 {
p.add(' ')