Skip to content

Commit

Permalink
Fix anonymous field index in range clause.
Browse files Browse the repository at this point in the history
Given the anonymousFields value []int{4, 5}, struct fields 0 and 1 were being decoded into instead of 4 and 5.
  • Loading branch information
abursavich authored Jan 2, 2018
1 parent 26fe5ac commit 384b9f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func (d *decoder) decodeStruct(
}

// This fills in embedded structs
for i := range fields.anonymousFields {
for _, i := range fields.anonymousFields {
_, err := d.unmarshalMap(size, offset, result.Field(i), depth)
if err != nil {
return 0, err
Expand Down

0 comments on commit 384b9f2

Please sign in to comment.