flag package
Canonical docs for command-line flag definitions, parsing, defaults, and custom flag values.
Canonical docs for command-line flag definitions, parsing, defaults, and custom flag values.
- Author: Go Team
- Authority: primary
- Kind: package-doc
- URL: https://pkg.go.dev/flag
What it covers
- flag declaration and parsing
- custom flag.Value implementations
- default and usage behavior
Why authoritative
Official package documentation for Go’s command-line flag APIs.
Use when
- how should I parse flags in Go
- how do custom flags work in Go
- when should a Go program use the flag package
Keywords
- flag, command line, flags, flag.Value, parsing