You'll need to create a FlagSet instead and pass ContinueOnError as
the error handling. If .Parse() returns an error call
.PrintDefaults(), then print the error.
On Sun, Dec 8, 2019 at 4:00 AM Thomas Nyberg wrote:
>
> Hello,
>
> Given the following file `flag_example.go`:
>
> package main
>
>
Hello,
Given the following file `flag_example.go`:
package main
import "flag"
func main() {
flagName := flag.String("flagName", "flagValue", "Help message.")
flag.Parse()
_ = flagName
}
If I execute it with a bad flag passed I see the following:
$ ./flag_example -flagName
flag