Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package to encapsulate float64 in protobuf

I was working in a microservice to create subscriptions in Stripe. One of the fields is listed as a float64 where I set it up as a float in the .proto file. This cast the field as a float32 not float64.

I cannot see a direct way to make protobuf to produce a file with the field typed as float64. Can someone help me here? Is there any special package for protobuf that encapsulates a float64?

Many Thanks

like image 281
Juanjo Avatar asked Oct 18 '25 12:10

Juanjo


1 Answers

As mentioned in Scalar Value Types, float64 in Go is defined with double in protobuf. So instead of writing:

float a_field = 1;

you will write:

double a_field = 1;
like image 166
Clément Jean Avatar answered Oct 21 '25 10:10

Clément Jean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!