-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: int32 is converted to incorrect string #416
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #416 +/- ##
=======================================
Coverage 55.19% 55.19%
=======================================
Files 87 87
Lines 5479 5479
=======================================
Hits 3024 3024
Misses 2233 2233
Partials 222 222 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks @mekpavit !
"github.com/line/line-bot-sdk-go/v8/linebot/messaging_api" | ||
) | ||
|
||
func TestGetFollowers_ItShouldCorrectlyPassLimitQueryParameter(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This bug was fixed as v8.2.1 , thank you! |
Currently,
stringify
macro inapi.pebble
doesn't handleint32
Go type properly. It directly usesstring(...)
to convertint32
tostring
which will generate a UTF-8 character corresponding to the value of int instead. For example,string(57)
will result in"9"
instead of"57"
. This bug makesMessagingApiAPI.GetFollowers(start string, limit int32)
to be nearly impossible to use.To fix this, this PR changes add another condition to
stringify
macro forInteger
type. With this change, it will usestrconv.FormatInteger(int64(...), 10)
instead ofstring(...)
which yield a correct string value.Apart from the bugfix, I also refactor
api.pebble
a bit to re-usestringify
macro for any place required to usestring
type. And also add another condition tostringify
macro to not doing an unnecessary string-conversion again forstring
type.