Support for fixed-size integer types
safety-tom opened this issue · 0 comments
safety-tom commented
Hi there, would you accept a PR that adds support for fixed-size integer types?
Motivation
When using smaller types (e.g. int8, uint16) users need to manually cast int
/uint
and perform bounds checking.
Proposal
It would look like this:
flag.Uint16Var(&HTTPPort, "port", 8080, "A port")
This code would induce a panic (as opposed to a silent wrap-around):
f := 65536 // doesn't fit in a uint16
flag.Uint16Var(&HTTPPort, "port", 8080, "A port")