Golang flag.FlagSet.Float64Var() function example
package flag
Float64Var defines a float64 flag with specified name(2nd parameter), default value(3rd parameter), and usage string(4th parameter). The argument p(1st parameter) points to a float64 variable in which to store the value of the flag.
Golang flag.FlagSet.Float64Var() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
var p float64
flagSet.Float64Var(&p, "diskchecktimeout", 1.0, "Time before disk check process time out. Default is 1.0")
flag.Parse()
fmt.Println(p)
}
Output :
1
Reference :
Advertisement
Something interesting
Tutorials
+10.1k Golang : How to tokenize source code with text/scanner package?
+4.9k Javascript : How to get width and height of a div?
+10k CodeIgniter : Load different view for mobile devices
+8.3k Golang : Check if integer is power of four example
+7.9k Golang : Gomobile init produce "iphoneos" cannot be located error
+9.1k Golang : Intercept and compare HTTP response code example
+21.4k Curl usage examples with Golang
+7.2k Golang : Dealing with postal or zip code example
+28.6k Golang : Read, Write(Create) and Delete Cookie example
+17.5k Golang : Find smallest number in array
+18.7k Golang : convert int to string
+8.8k Golang : Take screen shot of browser with JQuery example