add badflag test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-03-27 13:55:27 +03:00
parent 3ccffeb42b
commit ec564c021e
3 changed files with 14 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"flag"
"fmt"
"os"
"reflect"
"time"
@@ -44,6 +45,7 @@ func (c *flagConfig) Init(opts ...config.Option) error {
return err
}
flag.CommandLine.Init(os.Args[0], flag.ContinueOnError)
for _, sf := range fields {
tf, ok := sf.Field.Tag.Lookup(c.opts.StructTag)
if !ok {