Golang flag.Uint64Var() function example

package flag

Uint64Var defines a uint64 flag with specified name (2nd parameter), default value (3rd parameter), and usage string (4th parameter). The argument p (1st parameter) points to a uint64 variable in which to store the value of the flag.

Golang flag.Uint64Var() function usage example

 package main

 import (
 "flag"
 "fmt"
 )

 func main() {
 var appID uint64

 flag.Uint64Var(&appID, "FBAppID", 108, "Facebook Application ID")

 flag.Parse()

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

 fmt.Println(appID)

 }

Output :

&{FBAppID Facebook Application ID 108 108}

108

Reference :

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

Advertisement