hirokisan / bybit

Bybit client library for Go

Home Page:https://pkg.go.dev/github.com/hirokisan/bybit/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning: int vs int64

0cv opened this issue · comments

There are quite a few places in the app where int is used which is a placeholder for int32 on 32 bits machine and for int64 on 64 bits machine. While 32 bits machine are barely used anymore, thus int defaults to int64, if it were used (or compiled to, like mistakenly in my case, good catch hah!), this will fail to parse a java timestamp, both in the signature such as here or here, or will also fail to parse the response, such as here.

Typically the response error is
json: cannot unmarshal number 1,678,091,666,059 into Go struct field CommonV5Response.time of type int. Indeed because a int32 is maxed out at 2,147,483,647

Probably a low priority issue, but I think int64 shall be used to force 32bits machine to really use 64 bits.