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
+15.3k Golang : Get all local users and print out their home directory, description and group id
+12.2k Golang : calculate elapsed run time
+3.7k Java : Random alphabets, alpha-numeric or numbers only string generator
+9.5k Mac OSX : Get a process/daemon status information
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+15.6k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+25.9k Golang : How to read integer value from standard input ?
+6.1k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+8.8k Golang : Gorilla web tool kit schema example
+9.2k Golang : How to check if a string with spaces in between is numeric?
+9.1k Golang : Simple histogram example
+15.8k Golang : How to login and logout with JWT example