Golang flag.UintVar() function example
package flag
UintVar defines a uint flag with specified name(2nd parameter), default value(3rd parameter), and usage string(4th parameter). The argument p (1st parameter) points to a uint variable in which to store the value of the flag.
Golang flag.UintVar() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
var appID uint
flag.UintVar(&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 :
Advertisement
Something interesting
Tutorials
+9.8k Golang : Get current, epoch time and display by year, month and day
+19.2k Golang : Check whether a network interface is up on your machine
+11.6k Get form post value in Go
+8.5k Linux/Unix : fatal: the Postfix mail system is already running
+5.7k Fix yum-complete-transaction error
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+12.3k Golang : Display list of countries and ISO codes
+8.8k Golang : Executing and evaluating nested loop in html template
+7.5k Golang : Detect sample rate, channels or latency with PortAudio
+8.8k Golang : Get final balance from bit coin address example
+11.6k Golang : Display a text file line by line with line number example
+6.6k Golang : Embedded or data bundling example