-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove "github.com/jinzhu/copier" dependecy #952
Comments
@vrothberg PTAL |
I don't think that the number of static callers is a good metric to decide which dependencies can easily be pruned. This candidate seems easy to prune though.
Great catch!
I would love to have a function that creates a deep copy of a |
Of course it is not a very good metric. I just followed the import path from |
Yes, that would be useful in various places in the containers repos.
… and yes, we need to, to an extent, worry about forgetting to update the code, and only implementing a shallow copy. I don’t have a good idea how that could be done. How about finding some other reflection-based deep-copy Go package, with fewer dependencies? It seems quite possible to me that something like that exists, e.g. random search finds https://github.com/barkimedes/go-deepcopy which at least doesn’t look implausible in a 3-minute look. That would be a very local change in c/common. |
May I suggest something similar to Podman's JSONDeepCopy? Given the highly-optimized JSON libraries available, I suspect it's not significantly slower than a reflection-based solution, and it depends only on something we're already using. I would really like a code generation solution, but the only one I've found is in Kubernetes, and I've yet to figure out how to convince it to work outside their repo. |
I don't think a code generation solution is good if we try to reduce binary size. K8s is the biggest dependency in podman because it has so much generated code for each struct. |
I am against using JSONDeepCopy. It is very maintainable but quite expensive (see containers/podman#11781) and hungry for memory. Since
I doubt that a generated deep copy for a single struct (i.e., I am supportive of exploring the idea of using a generator - it would certainly be the most performant solution. If we can recycle the generator from K8s, even better - less work for us. |
Yes this my concern, for a single struct it will be fine. |
Just had another look at this issue. Given podman is now using I still think it would be nice to have a generator, so I'll keep it open. |
I am currently trying to shrink the podman binary size.
Looking through all dependencies I see that
github.com/jinzhu/copier
is only used a single time. While this package is only 204 K it importsdatabase/sql
which is 1.1 MB in size. By removing this we can save 1.3 MB.From the Commit (c53283f) messsage which added this dep:
So maybe we should just need to add a copy function in c/image?
The text was updated successfully, but these errors were encountered: