Open zonque opened 4 years ago
FWIW, this is
go version go1.14.3 linux/amd64
and
github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe
maybe put some basic prints in the parseFields call tree and see when it's being called
https://github.com/lunixbochs/struc/blob/a4cb8d33dbbefdc90689dbcaff46393d6c9cfb97/parse.go#L200
I've bumped into this weird issue and I still can't make sense of it.
Consider the following example:
The above doesn't work, the buffer remains empty. It can be fixed by passing
o
as a pointer:Now, the weird thing is: if the example struct is once unpacked before the packing, it works regardless of whether the struct is passed by value or by pointer.
This is not specific to the instance of the struct but a global effect. As long as the unpacking happened once in the running task, packing works fine.
Can anyone make sense of that? I'm not even sure if this is a bug.