Standard library / flag
flag.FlagSet
Independent argument parser; zero value uses ContinueOnError. Its Usage callback controls help output. Expected stdout: '3\n'.
Formal Syntax & Structure
go syntaxgo
type FlagSet struct { Usage func()
}Working Example
Example Snippetgo
package main
import ( "flag" "fmt")
func check(e error) { if e != nil { panic(e) }}
func main() { var f flag.FlagSet n := f.Int("n", 1, "count") check(f.Parse([]string{"-n=3"})) fmt.Println(*n)}