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
+6.9k Golang : How to solve "too many .rsrc sections" error?
+9.7k Golang : Sort and reverse sort a slice of floats
+5.2k Responsive Google Adsense
+22.9k Golang : Test file read write permission example
+4.7k JavaScript: Add marker function on Google Map
+33.6k Golang : How to check if slice or array is empty?
+10.3k Golang : Embed secret text string into binary(executable) file
+8.1k Golang : Variadic function arguments sanity check example
+7.3k Golang : How to fix html/template : "somefile" is undefined error?
+7.1k Golang : A simple forex opportunities scanner
+8.5k Golang : How to check if input string is a word?