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
+4.7k Golang : How to pass data between controllers with JSON Web Token
+16.6k Golang : Delete files by extension
+6.1k PageSpeed : Clear or flush cache on web server
+18.3k Golang : Get path name to current directory or folder
+15.6k Golang : Validate hostname
+13.8k Golang : unknown escape sequence error
+13.7k Golang : Check if an integer is negative or positive
+43.5k Golang : Get hardware information such as disk, memory and CPU usage
+5.4k Golang *File points to a file or directory ?
+8.3k Golang : Emulate NumPy way of creating matrix example
+16.5k Golang : Check if a string contains multiple sub-strings in []string?
+10.6k Golang : Allow Cross-Origin Resource Sharing request