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
+13.6k Android Studio : Password input and reveal password example
+5.9k Unix/Linux : How to open tar.gz file ?
+8.2k Golang : Metaprogramming example of wrapping a function
+21.2k Golang : Get password from console input without echo or masked
+11.5k Golang : Generate DSA private, public key and PEM files example
+5.8k Golang : List all packages and search for certain package
+6.9k Mac/Linux/Windows : Get CPU information from command line
+18.1k Golang : Convert IPv4 address to decimal number(base 10) or integer
+21.2k Golang : Clean up null characters from input data
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+6.5k Golang : Handling image beyond OpenCV video capture boundary
+19.6k Golang : Set or Add HTTP Request Headers