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.4k Your page has meta tags in the body instead of the head
+19.6k Golang : Get current URL example
+7.9k Golang : Trim everything onward after a word
+22.6k Generate checksum for a file in Go
+6.8k Get Facebook friends working in same company
+13.2k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+24k Golang : Find biggest/largest number in array
+13.9k Golang : How to check if a file is hidden?
+7.8k Golang : Reverse a string with unicode
+6.2k Golang & Javascript : How to save cropped image to file on server
+5.4k Golang *File points to a file or directory ?
+52.6k Golang : How to get struct field and value by name