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
+7.8k Golang : Regular Expression find string example
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode
+4.8k PHP : Extract part of a string starting from the middle
+8.9k Golang : GMail API create and send draft with simple upload attachment example
+15.6k Golang : ROT47 (Caesar cipher by 47 characters) example
+22.5k Golang : Convert Unix timestamp to UTC timestamp
+18.9k Golang : Read input from console line
+5.2k Golang : Experimental Jawi programming language
+51.9k Golang : How to get time in milliseconds?
+9.5k Golang : Extract or copy items from map based on value
+48.1k Golang : How to convert JSON string to map and slice
+6.2k Golang : Process non-XML/JSON formatted ASCII text file example