Standard library / flag

flag.FlagSet.Init()

Sets the name and error policy on a FlagSet; useful for a zero-value set. Expected stdout: 'demo\n'.

Formal Syntax & Structure

go syntaxgo
func (f *FlagSet) Init(name string, errorHandling ErrorHandling)

Parameters & Attributes

NameTypeDescription
namestringName of the flag or flag set.
errorHandlingErrorHandlingPolicy for parse errors and help requests.

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt")
func main() { var f flag.FlagSet; f.Init("demo", flag.ContinueOnError); fmt.Println(f.Name()) }
Go Reference