Golang flag.Bool() function example
package flag
Bool defines a bool flag with specified name (1st parameter) , default value (2nd parameter) , and usage string (3rd parameter). The return value is the address of a bool variable that stores the value of the flag.
Golang flag.Bool() function usage example
...
var writeFlag = flag.Bool("write", false, "If true, will write a value to the key")
if *writeFlag {
// do something
}
...
Reference :
Advertisement
Something interesting
Tutorials
+5.3k PHP : Hide PHP version information from curl
+10.1k Golang : Test a slice of integers for odd and even numbers
+13.4k Golang : Generate Code128 barcode
+7.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+32.2k Golang : Convert []string to []byte examples
+15.4k Golang : Find location by IP address and display with Google Map
+5.6k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+15.2k Golang : How to check if IP address is in range
+10.3k Golang : Detect number of faces or vehicles in a photo
+9.2k Golang : How to control fmt or log print format?
+22.9k Golang : Gorilla mux routing example
+6.5k Golang : Map within a map example