Skip to content

Commit

Permalink
MarshalJSON should produce unique result ID
Browse files Browse the repository at this point in the history
Result variable inside for-loop actually have the same address on each iteration, so we need to take address in underlying slice.
  • Loading branch information
MikhailChe authored and demget committed Nov 20, 2023
1 parent 7861084 commit e6590d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ type Results []Result

// MarshalJSON makes sure IQRs have proper IDs and Type variables set.
func (results Results) MarshalJSON() ([]byte, error) {
for _, result := range results {
for i, result := range results {
if result.ResultID() == "" {
result.SetResultID(fmt.Sprintf("%d", &result))
result.SetResultID(fmt.Sprintf("%d", &results[i]))
}
if err := inferIQR(result); err != nil {
return nil, err
Expand Down

0 comments on commit e6590d8

Please sign in to comment.