Closed gangtao closed 2 years ago
Print with %=v
, my version is 1.4.3
INFO[0000] config map[string]interface {}{"BatchSize":1, "Fields":[]interface {}{map[string]interface {}{"Limit":interface {}(nil), "Name":"device", "Range":[]interface {}{"device_0", "device_1", "device_2"}, "TimestampDelayMax":0, "TimestampDelayMin":0, "TimestampFormat":"", "Type":"string"}, map[string]interface {}{"Limit":[]interface {}{0, 100}, "Name":"number", "Range":interface {}(nil), "TimestampDelayMax":0, "TimestampDelayMin":0, "TimestampFormat":"", "Type":"int"}, map[string]interface {}{"Limit":interface {}(nil), "Name":"time", "Range":interface {}(nil), "TimestampDelayMax":0, "TimestampDelayMin":0, "TimestampFormat":"2006-01-02 15:04:05.000", "Type":"timestamp"}}, "Internval":200} map[string]interface {}
INFO[0000] parsed config generator.Configuration{BatchSize:0, Internval:0, Fields:[]generator.Field{generator.Field{Name:"device", Type:"string", Range:[]interface {}{"device_0", "device_1", "device_2"}, Limit:[]interface {}(nil), TimestampFormat:"", TimestampDelayMin:0, TimestampDelayMax:0}, generator.Field{Name:"number", Type:"int", Range:[]interface {}(nil), Limit:[]interface {}{0, 100}, TimestampFormat:"", TimestampDelayMin:0, TimestampDelayMax:0}, generator.Field{Name:"time", Type:"timestamp", Range:[]interface {}(nil), Limit:[]interface {}(nil), TimestampFormat:"", TimestampDelayMin:0, TimestampDelayMax:0}}} generator.Configuration
I think I may have the wrong key
due to the serialization. I will try to fix it.
This should work fine. If you can build a failing test case for me I'll take a closer look! Or, let me know if you're still having this issue. Thanks!
I have a nested structure like this. and some fields failed to decode.
original stucture defined like this:
I have saved the whole config to file and reload it from the file. when I decode it, some field were missing like
BatchSize
,Internval
,TimestampFormat
etc. did I write the wrong code or it is an issue?code :
here is the log