Skip to content

Conversation

aaron0x
Copy link

@aaron0x aaron0x commented Jun 15, 2021

fix #98 and #97

@jordanernult
Copy link

Hi @jinzhu,
Could you please, have a look to this PR.
This branch works well for me as the master doesn't.

Best Regards

@BatmanAoD
Copy link

I don't believe the problem is with time.Time but with the handling of private fields in general. It's impossible to deep-copy private fields using reflection, but the deep-copy logic should at least do a shallow copy of all public fields, which would make time.Time and other shallow-copyable structs with private members behave correctly.

@aaron0x
Copy link
Author

aaron0x commented Jul 9, 2021

I don't believe the problem is with time.Time but with the handling of private fields in general.

yes, I agree the problem is caused by unexported fields.
Since you have provided a general solution, I will just close this one.
Good job! @BatmanAoD

@maeglindeveloper
Copy link

Hey everyone,
I don't think this issue is fixed @jinzhu
see the following code https://go.dev/play/p/Lrcq_MhsH7t
using the latest version.
This is only happening when using deep copy option.

@BatmanAoD
Copy link

@maeglindeveloper That example works now; I suspect it failed originally because the fix hadn't been included in a release tag yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeepCopy doesn't Copy time.Tme Fields
4 participants