Golang flag.FlagSet.IntVar() function example
package flag
IntVar defines an int flag with specified name(2nd parameter), default value(3rd parameter), and usage string(4th parameter). The argument p(1st parameter) points to an int variable in which to store the value of the flag.
Golang flag.FlagSet.IntVar() function usage example
package main
import (
"flag"
"fmt"
)
func main() {
flagSet := flag.NewFlagSet("check", flag.ExitOnError)
var p int
flagSet.IntVar(&p, "diskchecktimeout", 1, "Disk check process time out. Default is 1 hour.")
flag.Parse()
fmt.Println(p)
}
Reference :
Advertisement
Something interesting
Tutorials
+5.9k Golang : Generate multiplication table from an integer example
+5.8k Golang : Find change in a combination of coins example
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat
+13.1k Golang : List objects in AWS S3 bucket
+8.4k Golang : Convert word to its plural form example
+3.6k Java : Get FX sentiment from website example
+6.6k Golang : Embedded or data bundling example
+10.8k Golang : Command line file upload program to server example
+14.4k Golang : Recombine chunked files example
+19.9k Golang : How to get time from unix nano example
+7.4k Golang : Convert source code to assembly language