Skip to content

Commit e6590d8

Browse files
MikhailChedemget
authored andcommitted
MarshalJSON should produce unique result ID
Result variable inside for-loop actually have the same address on each iteration, so we need to take address in underlying slice.
1 parent 7861084 commit e6590d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inline.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ type Results []Result
9393

9494
// MarshalJSON makes sure IQRs have proper IDs and Type variables set.
9595
func (results Results) MarshalJSON() ([]byte, error) {
96-
for _, result := range results {
96+
for i, result := range results {
9797
if result.ResultID() == "" {
98-
result.SetResultID(fmt.Sprintf("%d", &result))
98+
result.SetResultID(fmt.Sprintf("%d", &results[i]))
9999
}
100100
if err := inferIQR(result); err != nil {
101101
return nil, err

0 commit comments

Comments
 (0)