go-opendota icon indicating copy to clipboard operation
go-opendota copied to clipboard

PlayerParam Significant not working with a value of 0 because of omitempty

Open OperationalDev opened this issue 4 years ago • 1 comments

Ran into an issue that when I pass &opendota.PlayerParam{Significant:0}, omitempty causes 0 to be seen as an empty value.

type PlayerParam struct {
	Limit         int      `url:"limit,omitempty"`
	Offset        int     `url:"offset,omitempty"`
        ...
	Significant   int      `url:"significant,omitempty"`
}

To get around this, I tested removing omitempty as well as passing the int value with a pointer which both worked. Happy to put in a pull request for whichever option.

On an unrelated note, awesome package! It's really handy.

OperationalDev avatar Apr 03 '20 10:04 OperationalDev

Removing omitempty would be fine in this case!

jasonodonnell avatar Apr 03 '20 13:04 jasonodonnell