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 :

http://golang.org/pkg/flag/#FlagSet.Int64

Advertisement