awalterschulze / goderive

Derives and generates mundane golang functions that you do not want to maintain yourself
Apache License 2.0
1.23k stars 44 forks source link

Deep copy time.Time #72

Open josephbuchma opened 2 years ago

josephbuchma commented 2 years ago

Partially resolves #47

awalterschulze commented 2 years ago

This doesn't seem to follow the proposed design discussed in #47 I think time is just one case with private fields. It would great if we could extend this to handle more cases with the design discussed in #47

josephbuchma commented 2 years ago

I agree. I just quickly added it for myself, and thought why not open PR. Is anyone actively working on generic solution?

awalterschulze commented 2 years ago

Currently no one is working on the generic solution, so you are free to go for it, if you would like.

Also if you would like to propose a different solution, we can also discuss in it #47 But, my main concerns with this solution is adding more and more special cases over time, which I would prefer not to support. I hope that makes sense.

josephbuchma commented 2 years ago

It makes sense. But even with generic solution available, I think it's worth having support for stdlib types like time.Time out of box

awalterschulze commented 2 years ago

It makes sense. But even with generic solution available, I think it's worth having support for stdlib types like time.Time out of box

Good point, how many stdlib types are there with private fields? I am sure time.Time is the most popular, but I wonder how many special cases we would have to handle to provide this smooth experience for users.