Golang flag.FlagSet.Int64() function example
package flag
Int64 defines an int64 flag with specified name(1st parameter), default value(2nd parameter), and usage string(3rd parameter). The return value is the address of an int64 variable that stores the value of the flag.
Golang flag.FlagSet.Int64() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
hour := flagSet.Int64("diskchecktimeout", 1, "Disk check process time out. Default is 1 hour.")
flag.Parse()
fmt.Println(*hour)
}
Output :
1
Reference :
Advertisement
Something interesting
Tutorials
+22.1k Golang : Match strings by wildcard patterns with filepath.Match() function
+20.7k Android Studio : AlertDialog and EditText to get user string input example
+25.9k Golang : How to read integer value from standard input ?
+19.1k Mac OSX : Homebrew and Golang
+20.5k Golang : Pipe output from one os.Exec(shell command) to another command
+14k Golang : convert rune to unicode hexadecimal value and back to rune character
+11.7k Golang : Find age or leap age from date of birth example
+9.7k Random number generation with crypto/rand in Go
+12.7k Golang : Remove or trim extra comma from CSV
+17.4k Golang : Check if IP address is version 4 or 6
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+11.6k Golang : Display a text file line by line with line number example