Use `encoding/binary`. Yes, you have to care about byte order. But that's
inherent to the question. There is no canonical way in which an integer
correspond to a slice of bytes, you actually have to say how to encode it.
That also doesn't cause any problems - on the contrary, being explicit
about
On Mon, Nov 21, 2022 at 9:57 AM Nikhilesh Susarla
wrote:
> I have an int64 value say 12
> I want to convert that to []byte array.
Such conversion is not supported. Also, []byte is a slice.
However, the desired result can be computed in code. You can use the
encoding/binary package for that.
Hi,
I have an int64 value say 12
I want to convert that to []byte array.
How do we do that. There were lot of ways on the internet. Nothing which
golang specifies or has a built-package for direct conversions. Lot of them
dealt with Endiean's, but that might cause issues to I believe.
So, is