Golang flag.Int64() function example
package flag
Int64 defines an int64 flag with specified name(1st parameter), default value (2nd parameter), and usage(3rd parameter) string. The return value is the address of an int64 variable that stores the value of the flag.
Golang flag.Int64() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
numberval := flag.Int64("number", 10800, "is an int64 value")
fmt.Println(flag.Lookup("number")) // print Flag struct
fmt.Println("number value : ", *numberval)
}
Output :
&{number is an int64 value 10800 10800}
number value : 10800
Reference :
Advertisement
Something interesting
Tutorials
+18.6k Golang : Get download file size
+12.3k Golang : Display list of countries and ISO codes
+5.5k Golang : Stop goroutine without channel
+5.8k Golang : List all packages and search for certain package
+19.2k Golang : Delete item from slice based on index/key position
+9.7k Random number generation with crypto/rand in Go
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+6.9k Golang : Pat multiplexer routing example
+19.6k Golang : Get current URL example
+14k Golang : convert rune to unicode hexadecimal value and back to rune character
+16.1k Golang : Generate universally unique identifier(UUID) example
+5.8k Golang : Launching your executable inside a console under Linux