Golang flag.FlagSet.Int64() function example
package flag
Int64 defines an int64 flag with specified name(1st parameter), default value(2nd parameter), and usage string(3rd parameter). The return value is the address of an int64 variable that stores the value of the flag.
Golang flag.FlagSet.Int64() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
hour := flagSet.Int64("diskchecktimeout", 1, "Disk check process time out. Default is 1 hour.")
flag.Parse()
fmt.Println(*hour)
}
Output :
1
Reference :
Advertisement
Something interesting
Tutorials
+12.7k Golang : Sort and reverse sort a slice of bytes
+16.8k Golang : Get own process identifier
+10.9k Golang : Get UDP client IP address and differentiate clients by port number
+9.8k Golang : Format strings to SEO friendly URL example
+6.9k Golang : Normalize email to prevent multiple signups example
+6.3k Golang : How to get capacity of a slice or array?
+7.3k Golang : alternative to os.Exit() function
+5.2k Golang : Customize scanner.Scanner to treat dash as part of identifier
+30.6k Golang : Remove characters from string example
+19.5k Golang : Example for DSA(Digital Signature Algorithm) package functions
+11.3k Golang : Characters limiter example
+5.4k Golang : Intercept, inject and replay HTTP traffics from web server