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
| Name | Type | Description |
|---|---|---|
| name | string | Name of the flag or flag set. |
| errorHandling | ErrorHandling | Policy 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()) }