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.
pull/625/head^2
Mikhail 1 year ago committed by demget
parent 78610849e1
commit e6590d806a

@ -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

Loading…
Cancel
Save