mirror of
https://github.com/tucnak/telebot
synced 2024-11-05 06:00:58 +00:00
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.
This commit is contained in:
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…
Reference in New Issue
Block a user