Standard library / flag

flag.FlagSet.Name()

Returns the parser name used in help and diagnostics. Expected stdout: 'serve\n'.

Formal Syntax & Structure

go syntaxgo
func (f *FlagSet) Name() string

Return Value

string

Returns the parser name used in help and diagnostics.

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt")
func main() { f := flag.NewFlagSet("serve", flag.ContinueOnError); fmt.Println(f.Name()) }
Go Reference