I wanted to understand which of 2 options are more optimal/faster for converting a float value to a string in a struct’s response:
Option 1
Use the strconv.FormatFloat
function; can be used for 64 or 32 bits, can specify precision, etc.
Option 2
Specify the string option in a json tag
Val float64 `json:"val,string"`