Golang flag.FlagSet.Int64Var() function example
package flag
Int64Var defines an int64 flag with specified name(2nd parameter), default value(3rd parameter), and usage string(4th parameter). The argument p(1st parameter) points to an int64 variable in which to store the value of the flag.
Golang flag.FlagSet.Int64Var() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
var p int64
flagSet.Int64Var(&p, "diskchecktimeout", 1, "Disk check process time out. Default is 1 hour.")
flag.Parse()
fmt.Println(p)
}
Output :
1
Reference :
Advertisement
Something interesting
Tutorials
+6.9k Golang : Decode XML data from RSS feed
+8.1k Golang : HTTP Server Example
+10.2k Golang : Random Rune generator
+43.3k Golang : Convert []byte to image
+22.2k Golang : How to run Golang application such as web server in the background or as daemon?
+16k Golang : Read large file with bufio.Scanner cause token too long error
+10.5k Swift : Convert (cast) String to Integer
+32.5k Golang : Copy directory - including sub-directories and files
+5.4k Golang : Get S3 or CloudFront object or file information
+9.2k Golang : Write multiple lines or divide string into multiple lines
+5.3k Python : Convert(cast) string to bytes example
+17.2k Golang : When to use init() function?