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
+11.7k How to tell if a binary(executable) file or web application is built with Golang?
+6.3k WARNING: UNPROTECTED PRIVATE KEY FILE! error message
+11.7k Golang : Gorilla web tool kit secure cookie example
+5.7k Get website traffic ranking with Similar Web or Alexa
+15.9k Golang : Read a file line by line
+13.9k Golang : How to determine if a year is leap year?
+12.6k Golang : Get absolute path to binary for os.Exec function with exec.LookPath
+8.3k Golang: Prevent over writing file with md5 hash
+4.9k Nginx and PageSpeed build from source CentOS example
+11.5k Golang : Change date format to yyyy-mm-dd
+6.7k Golang : Check if password length meet the requirement
+8.8k Golang : Get final balance from bit coin address example