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
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+13.8k Generate salted password with OpenSSL example
+29.9k Golang : How to get HTTP request header information?
+6.3k Golang : Extract sub-strings
+10.6k Golang : Allow Cross-Origin Resource Sharing request
+10.2k Golang : How to profile or log time spend on execution?
+6.3k Javascript : Generate random key with specific length
+9.4k Android Studio : Indicate progression with ProgressBar example
+9.1k Golang : Simple histogram example
+17k Golang : Covert map/slice/array to JSON or XML format
+36.3k Golang : How to split or chunking a file to smaller pieces?
+7.2k Golang : Dealing with postal or zip code example