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
+8.5k Golang : How to check variable or object type during runtime?
+9.4k Golang : How to protect your source code from client, hosting company or hacker?
+11.3k Golang : Characters limiter example
+48.1k Golang : How to convert JSON string to map and slice
+7.7k Golang : Command line ticker to show work in progress
+13.9k Golang : How to check if a file is hidden?
+7.4k Golang : Check to see if *File is a file or directory
+10.2k Golang : How to get quoted string into another string?
+7.3k Golang : Of hash table and hash map
+14.9k Golang : Submit web forms without browser by http.PostForm example
+39k Golang : How to iterate over a []string(array)