mirror of
https://github.com/golang/go
synced 2024-11-25 01:27:56 -07:00
Check for errors when writing fields of a struct.
R=rsc CC=golang-dev, jack.palevich https://golang.org/cl/183109
This commit is contained in:
parent
f221067fe8
commit
a0ee18bdd5
@ -366,7 +366,11 @@ func writeStruct(w io.Writer, val *reflect.StructValue) os.Error {
|
||||
for i := 0; i < val.NumField(); i++ {
|
||||
fieldValue := val.Field(i)
|
||||
fmt.Fprintf(w, "%q:", typ.Field(i).Name)
|
||||
writeValue(w, fieldValue)
|
||||
|
||||
if err := writeValue(w, fieldValue); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if i < val.NumField()-1 {
|
||||
fmt.Fprint(w, ",")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user