Golang flag.FlagSet.Int64Var() function example

package flag

Int64Var defines an int64 flag with specified name(2nd parameter), default value(3rd parameter), and usage string(4th parameter). The argument p(1st parameter) points to an int64 variable in which to store the value of the flag.

Golang flag.FlagSet.Int64Var() function usage example

 package main

 import (
 "flag"
 "fmt"
 )

 func main() {

 flagSet := flag.NewFlagSet("check", flag.ExitOnError)

 var p int64

 flagSet.Int64Var(&p, "diskchecktimeout", 1, "Disk check process time out. Default is 1 hour.")

 flag.Parse()

 fmt.Println(p)

 }

Output :

1

Reference :

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

Advertisement