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
+6.5k PHP : Shuffle to display different content or advertisement
+37.7k Golang : Comparing date or timestamp
+17.6k Golang : Parse date string and convert to dd-mm-yyyy format
+5.3k Python : Convert(cast) string to bytes example
+5.8k Javascript : How to replace HTML inside <div>?
+19.3k Golang : Calculate entire request body length during run time
+7.9k Swift : Convert (cast) String to Float
+11.6k Golang : Simple file scaning and remove virus example
+7.9k Javascript : How to check a browser's Do Not Track status?
+5k Google : Block or disable caching of your website content
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it