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
+14.8k Golang : Normalize unicode strings for comparison purpose
+25.3k Golang : Get current file path of a file or executable
+5.5k Golang : Stop goroutine without channel
+5.5k Golang : If else example and common mistake
+7.4k Golang : Individual and total number of words counter example
+11.2k Google Maps URL parameters configuration
+9.2k Golang : does not implement flag.Value (missing Set method)
+6.4k PHP : Proper way to get UTF-8 character or string length
+8.4k Golang : Ackermann function example
+5.1k Swift : Convert (cast) Float to Int or Int32 value
+14.3k Golang : Get uploaded file name or access uploaded files
+5.1k Golang : Display packages names during compilation