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
+5.3k Golang : How to deal with configuration data?
+10.2k Golang : Text file editor (accept input from screen and save to file)
+6.9k Golang : Calculate BMI and risk category
+8.5k PHP : How to parse ElasticSearch JSON ?
+11.7k Golang : Find age or leap age from date of birth example
+4.6k Javascript : Detect when console is activated and do something about it
+7.5k Golang : Shuffle strings array
+29.9k Golang : Get and Set User-Agent examples
+12.9k Python : Convert IPv6 address to decimal and back to IPv6
+6.8k Golang : Get expvar(export variables) to work with multiplexer
+5.2k Golang : Print instead of building pyramids
+7.1k Golang : Squaring elements in array