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.8k Linux : Disable and enable IPv4 forwarding
+4.8k Golang : A program that contain another program and executes it during run-time
+19.9k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+32.2k Golang : Convert []string to []byte examples
+11.9k Golang : How to parse plain email text and process email header?
+12.5k Golang : HTTP response JSON encoded data
+10.6k Golang : Get local time and equivalent time in different time zone
+17.6k Golang : delete and modify XML file content
+7.4k Android Studio : How to detect camera, activate and capture example
+55.3k Golang : Unmarshal JSON from http response
+14k Golang : convert rune to unicode hexadecimal value and back to rune character