Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created December 24, 2018 00:49
Show Gist options
  • Save miguelmota/399d42487282fac7628ff2b7cd2a60b8 to your computer and use it in GitHub Desktop.
Save miguelmota/399d42487282fac7628ff2b7cd2a60b8 to your computer and use it in GitHub Desktop.
Golang float format no trailing zeros
package main
import (
"fmt"
"strconv"
)
func main() {
value := strconv.FormatFloat(10.900, 'f', -1, 64) // 10.9
fmt.Println(value)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment