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
+15.6k Golang : Validate hostname
+18.5k Golang : Example for RSA package functions
+14.1k Javascript : Prompt confirmation before exit
+6k Javascript : Get operating system and browser information
+10.3k Golang : Embed secret text string into binary(executable) file
+6.3k Golang : Detect face in uploaded photo like GPlus
+33.6k Golang : How to check if slice or array is empty?
+9.4k Golang : Scramble and unscramble text message by randomly replacing words
+14.6k Golang : Send email with attachment(RFC2822) using Gmail API example
+11.2k Google Maps URL parameters configuration
+7.1k Golang : Get environment variable
+9.7k Random number generation with crypto/rand in Go