Standard library / flag
flag.FlagSet.Parsed()
Reports whether Parse has been called, not whether all inputs were valid. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (f *FlagSet) Parsed() boolReturn Value
bool
Reports whether Parse has been called, not whether all inputs were valid.
Working Example
Example Snippetgo
package main
import ( "flag" "fmt" "os")
func check(e error) { if e != nil { panic(e) }}
func main() { f := flag.NewFlagSet("demo", flag.ContinueOnError) v := f.Int("x", 0, "value") _ = v check(f.Parse(os.Args[1:])) fmt.Println(f.Parsed())}