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.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+5k Python : Convert(cast) bytes to string example
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+16.3k Golang : Find out mime type from bytes in buffer
+10.1k Golang : Compare files modify date example
+10.3k Golang : Convert file unix timestamp to UTC time example
+9k Golang : Get SPF and DMARC from email headers to fight spam
+22.4k Golang : Read directory content with filepath.Walk()
+6.1k PageSpeed : Clear or flush cache on web server
+13.9k Golang : How to check if a file is hidden?
+11.5k Golang : Generate DSA private, public key and PEM files example
+13.7k Golang : Tutorial on loading GOB and PEM files