Open rohans81 opened 6 years ago
Fields with properties:"-"
are ignored but that would still be a bug.
When I try this specific example Decode returns an error. Do you check all the errors?
Added this to decode_test.go
func TestDecodeSkipFail(t *testing.T) {
type S struct {
V sarama.KafkaVersion `properties:"kafka.version,default=0.11.0.2"`
S string
}
in := `S=some value`
out := &S{sarama.V0_11_0_2, "some value"}
testDecode(t, in, &S{}, out)
}
--- FAIL: TestDecodeSkipFail (0.00s)
decode_test.go:298: got cannot set version want nil
yes. I had missed checking the error. It would be helpful to add the details around ignoring properties to README file. Thanks.
This should be in the godoc or isn’t it?
There are some bugs when we specify properties as part of the struct metadata. e.g
config file
It fails on the first field/property it has a issue within the struct. All fields after this filed (in struct order) are not processed. e.g if the field KafkaVersion could not be decoded then all fields below it will also not be decoded.
There are issues in following cases 1> The property is missing in property file and no default value is mentioned in the struct 2> if the field type is not supported by decoder eg (sarama.KafkaVersion) 3> if the fields in the struct do not have the property tag and a property with the field name is not present in the property file.
Is there any way we can exclude a field from decode logic? Regards Rohan