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
+4.7k MariaDB/MySQL : Form select statement or search query with Chinese characters
+9.6k Golang : Read file with ioutil
+22.1k Golang : Join arrays or slices example
+8.3k Golang : Configure Apache and NGINX to access your Go service example
+6.5k Golang : Map within a map example
+41.4k Golang : Convert string to array/slice
+10.5k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+15.4k Golang : invalid character ',' looking for beginning of value
+9.8k Golang : Qt get screen resolution and display on center example
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+6.6k Golang : How to validate ISBN?
+10.9k Golang : Sieve of Eratosthenes algorithm