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
+38.1k Golang : Read a text file and replace certain words
+15k Golang : package is not in GOROOT during compilation
+9.8k Golang : Resumable upload to Google Drive(RESTful) example
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+8.4k Your page has meta tags in the body instead of the head
+9.4k Golang : Apply Histogram Equalization to color images
+10.1k Golang : Edge detection with Sobel method
+6.8k Golang : Get expvar(export variables) to work with multiplexer
+8.9k Golang : Gaussian blur on image and camera video feed examples
+10.9k Golang : How to transmit update file to client by HTTP request example
+9.9k Golang : Function wrapper that takes arguments and return result example
+20.7k Golang : Saving private and public key to files