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
+41.4k Golang : Convert string to array/slice
+18.8k Golang : How to make function callback or pass value from function as parameter?
+6.3k Golang : Selection sort example
+7.1k Golang : A simple forex opportunities scanner
+12.4k Elastic Search : Return all records (higher than default 10)
+18.7k Golang : convert int to string
+13.1k Golang : List objects in AWS S3 bucket
+10.6k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?
+7.1k Restart Apache or Nginx web server without password prompt
+6.5k Golang : Handling image beyond OpenCV video capture boundary
+11.6k Golang : Concurrency and goroutine example
+18.5k Golang : Set, Get and List environment variables