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
+20.7k Golang : Read directory content with os.Open
+13.9k Golang : Get current time
+11.5k Golang : Generate DSA private, public key and PEM files example
+19.3k Golang : Get RGBA values of each image pixel
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+6.8k Golang : Join lines with certain suffix symbol example
+6.2k Golang : Extract XML attribute data with attr field tag example
+12.2k Golang : Get remaining text such as id or filename after last segment in URL path
+16.4k CodeIgniter/PHP : Create directory if does not exist example
+10.3k Golang : How to check if a website is served via HTTPS
+10.6k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)