integrii / flaggy

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.
The Unlicense
856 stars 30 forks source link

Parsing errors was silenced! #64

Closed pavelpatrin closed 2 years ago

pavelpatrin commented 4 years ago

Hello!

Currently if passed flag has bad value the parsing error is silenced. In this case flag variable dont changed and saves original default value.

func main() {
    var intFlag = 123456
    flaggy.Int(&intFlag, "f", "flag", "A test string flag")
    flaggy.Parse()

    // go run main.go --flag abc
    print(intFlag) // 123456
}

I think this behavior is strange and triggers wrong software behavior.

What do you think about this?