go-arg icon indicating copy to clipboard operation
go-arg copied to clipboard

`int` with `arg:"env"` results in `strconv.ParseInt: parsing "": invalid syntax` if environment variable is empty

Open nyetwurk opened this issue 3 years ago • 2 comments

Not sure what it should do instead, since there is no NaN for integers.

Maybe allow *int which would result in nil?

Easiest would be to treat it as if it was undefined.

nyetwurk avatar Jul 24 '21 00:07 nyetwurk

Yes I do think that an empty environment variable should result in the zero value, not an error. I may be able to look into this in next few weeks. Thank you for the report.

alexflint avatar Jul 24 '21 05:07 alexflint

Should not the default value have taken effect if the env variable is empty?

dyfet avatar Dec 27 '21 17:12 dyfet