Golang flag.Int64Var() function example
package flag
Int64Var defines an int64 flag with specified name(2nd parameter), default value(3rd parameter), and usage(4th parameter) string. The argument p(1st parameter) points to an int64 variable in which to store the value of the flag.
Golang flag.Int64Var() function usage example
package main
import (
"flag"
"fmt"
"time"
)
var rand64seed int64
func main() {
flag.Int64Var(&rand64seed, "randomseed", time.Now().Unix() , "Seed for randomizing")
fmt.Println(flag.Lookup("randomseed")) // print Flag struct
fmt.Println("seed value : ", rand64seed)
}
Output :
&{randomseed Seed for randomizing 1413179827 1413179827}
seed value : 1413179827
Reference :
Advertisement
Something interesting
Tutorials
+12.9k Python : Convert IPv6 address to decimal and back to IPv6
+21.1k Golang : For loop continue,break and range
+11.6k Golang : Convert(cast) float to int
+21.4k Curl usage examples with Golang
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+5.5k Golang : Stop goroutine without channel
+5.8k Unix/Linux : Get reboot history or check when was the last reboot date
+10.6k Golang : How to delete element(data) from map ?
+14.6k Golang : Send email with attachment(RFC2822) using Gmail API example
+14k Golang : Human readable time elapsed format such as 5 days ago
+5.4k Javascript : How to loop over and parse JSON data?