Golang flag.Int64() function example

package flag

Int64 defines an int64 flag with specified name(1st parameter), default value (2nd parameter), and usage(3rd parameter) string. The return value is the address of an int64 variable that stores the value of the flag.

Golang flag.Int64() function usage example

 package main

 import (
 "flag"
 "fmt"
 )

 func main() {

 numberval := flag.Int64("number", 10800, "is an int64 value")

 fmt.Println(flag.Lookup("number")) // print Flag struct

 fmt.Println("number value : ", *numberval)
 }

Output :

&{number is an int64 value 10800 10800}

number value : 10800

Reference :

http://golang.org/pkg/flag/#Int64

Advertisement