Standard library / flag

flag.ContinueOnError

Returns parsing errors to the caller rather than exiting or panicking. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
const ContinueOnError ErrorHandling = 0

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt"  "io")
func main() {  f := flag.NewFlagSet("demo", flag.ContinueOnError)  f.SetOutput(io.Discard)  fmt.Println(f.Parse([]string{"-unknown"}) != nil)}
Go Reference