Golang flag.FlagSet.Float64Var() function example
package flag
Float64 defines a float64 flag with specified name(1st parameter), default value(2nd parameter), and usage string(3rd parameter). The return value is the address of a float64 variable that stores the value of the flag.
Golang flag.FlagSet.Float64() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
diskchecktime := flagSet.Float64("diskchecktime", 1.0, "Amount of time to allow for a single disk check process")
flag.Parse()
fmt.Println(*diskchecktime)
}
Output :
1
Reference :
Advertisement
Something interesting
Tutorials
+11.2k CodeIgniter : How to check if a session exist in PHP?
+18.5k Golang : Aligning strings to right, left and center with fill example
+21.5k Golang : How to read float value from standard input ?
+5.6k Javascript : How to refresh page with JQuery ?
+15.6k Golang : ROT47 (Caesar cipher by 47 characters) example
+5.6k PHP : Convert CSV to JSON with YQL example
+26.1k Mac/Linux and Golang : Fix bind: address already in use error
+23.5k Golang : Read a file into an array or slice example
+15.9k Golang : Read a file line by line
+32.7k Golang : Regular Expression for alphanumeric and underscore
+4.8k Which content-type(MIME type) to use for JSON data
+8.2k Prevent Write failed: Broken pipe problem during ssh session with screen command