2

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

0

1 Answer 1

7

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;
1
  • Thanks. I didn't see that one. I guess I was too tired.
    – Juanjo
    May 6, 2022 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.