Closed ramilexe closed 1 week ago
In the bot.Summary() method, you allocate slice for returnsPercent with fixed length https://github.com/rodrigo-brito/ninjabot/blob/2325ed95bb6f0bac3d011443c4596b4329e9a695/ninjabot.go#L243
bot.Summary()
returnsPercent
Then you use append method to add elements to the slice and it increases size of the slice and, probably, calculate histogram incorrectly: https://github.com/rodrigo-brito/ninjabot/blob/2325ed95bb6f0bac3d011443c4596b4329e9a695/ninjabot.go#L245
append
Before fix:
After fix:
You are right, this is a big mistake! Thank you for the report and pull request
Closed by https://github.com/rodrigo-brito/ninjabot/pull/333
In the
bot.Summary()
method, you allocate slice forreturnsPercent
with fixed length https://github.com/rodrigo-brito/ninjabot/blob/2325ed95bb6f0bac3d011443c4596b4329e9a695/ninjabot.go#L243Then you use
append
method to add elements to the slice and it increases size of the slice and, probably, calculate histogram incorrectly: https://github.com/rodrigo-brito/ninjabot/blob/2325ed95bb6f0bac3d011443c4596b4329e9a695/ninjabot.go#L245