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
+9.3k Golang : How to protect your source code from client, hosting company or hacker?
+7k Golang : Takes a plural word and makes it singular
+6.8k Android Studio : Hello World example
+10k Golang : Read file and convert content to string
+7.6k Android Studio : AlertDialog to get user attention example
+11k How to test Facebook App on localhost ?
+7.9k Golang : Gomobile init produce "iphoneos" cannot be located error
+21.6k Golang : Encrypt and decrypt data with TripleDES
+11.6k Android Studio : Create custom icons for your application example
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+39.2k Golang : How to read CSV file