Golang flag.Uint64() function example
package flag
Uint64 defines a uint64 flag with specified name(1st parameter), default value(2nd parameter), and usage string(3rd parameter). The return value is the address of a uint64 variable that stores the value of the flag.
Golang flag.Uint64() function usage example
package main
import (
"flag"
"fmt"
"strconv"
)
func main() {
hotDataSize := flag.Uint64("hotDataSize", 0, "Hot data size in bytes. 0 disables hot data optimization")
flag.Parse()
fmt.Println(flag.Lookup("hotDataSize")) // print the Flag struct
fmt.Printf("Hot Data Size is %s\n ", strconv.FormatUint(uint64(*hotDataSize), 3))
}
Output :
&{hotDataSize Hot data size in bytes. 0 disables hot data optimization 0 0}
Hot Data Size is 0
Reference :
Advertisement
Something interesting
Tutorials
+17.4k Golang : Get future or past hours, minutes or seconds
+6k Golang : Compound interest over time example
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+14.5k Golang : Rename directory
+7.9k Setting $GOPATH environment variable for Unix/Linux and Windows
+7.1k Golang : Transform lisp or spinal case to Pascal case example
+5.4k Golang : Qt update UI elements with core.QCoreApplication_ProcessEvents
+6k Golang : How to verify input is rune?
+5.6k Swift : Get substring with rangeOfString() function example
+51.1k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+7.7k Golang : Error reading timestamp with GORM or SQL driver