Closed kartavya-ramnani closed 4 years ago
What needs to be fixed : Replace in read_command_reflect.go -> setStructValue :
tag := strings.Trim(fld.Tag.Get(aerospikeTag), " ")
with
tag := strings.Trim(stripOptions(fld.Tag.Get(aerospikeTag)), " ")
Commit which may have introduced this.
I guess, before introducing the omitempty tag, this must be working fine but after introducing omitempty tag with 2.8.0 , this bug crept in..
Any way we can fix this asap? It is a one-line code change.
I tried to fix it today, but this issue turned out to be related to a bigger problem that I have to address. Will release the fix next week.
Can I ask what is the bigger problem ? @khaf We are using this library on high production traffic.
The PR that introduced this bug introduced another regression that tests didn't catch, and now I have to find a way to fix it in a way that is backwards compatible without breaking the internet.
Hi @khaf : Is this fixed ?
Not yet; I'm now considering releasing a quick fix for you and spend a bit more time for the other one.
@khaf : Will appreciate it if you do that.
Fix released in v3.0.1. Thank you for your patience.
If there a struct inside a struct which has fields with omitempty tag, that field NEVER gets fetched.
For example :
struct A { Bstruct B
as:"b"
}struct B { Test string
as:"test,omitempty"
// this will never be returned in any read reflection commands }Reason :
Inside read_command_reflect.go : setStructValue : alias will be Test Then this line comes :
and tag is test,omitempty so alias becomes test,omitempty
And valMap[alias] will fail.
This is a major bug in my opinion and I can really use help in getting this fixed asap.