The current behavior does not correctly handle numbers with a fixed size (such as uint8 or int16)
Unmarshal should return an error in the same way it does for float32 and float64, which are correctly managed
Example of a case where a "value out of range" is not detected:
type whatever struct {
Value uint8 `env:"VALUE_UINT8,required"` // Value in [0; 255]
}
os.Setenv("VALUE_UINT8", "300")
var w whatever
_, err := env.UnmarshalFromEnviron(&w)
if err != nil {
panic(err)
}
fmt.Println("w:", w)
// Prints 300 mod 256 = 44
// w: {44}
The current behavior does not correctly handle numbers with a fixed size (such as
uint8orint16)Unmarshal should return an error in the same way it does for
float32andfloat64, which are correctly managedExample of a case where a "value out of range" is not detected: