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
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+6.7k Golang : Derive cryptographic key from passwords with Argon2
+5.2k Python : Create Whois client or function example
+16.4k Golang : How to implement two-factor authentication?
+6k Golang : Experimenting with the Rejang script
+28.6k Get file path of temporary file in Go
+7.4k Golang : Convert source code to assembly language
+5.9k Golang : Detect variable or constant type
+26.7k Golang : How to check if a connection to database is still alive ?
+7.9k Swift : Convert (cast) String to Float
+8.1k Golang : Multiplexer with net/http and map
+7.3k Golang : Not able to grep log.Println() output