Skip to content
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

去除github.com/json-iterator/go依赖,以允许dead code eliminate #121

Open
huww98 opened this issue Dec 7, 2024 · 1 comment
Open

Comments

@huww98
Copy link

huww98 commented Dec 7, 2024

github.com/json-iterator/go库已长期无更新。

另外,github.com/modern-go/reflect2使用了一些反射技巧,使Golang链接器的dead code eliminate功能无法工作。在彻底去除reflect2后,CSI的二进制大小将从65M缩减到30M,缩减一半以上,非常可观。

@huww98
Copy link
Author

huww98 commented Dec 9, 2024

我测试了直接替换为encoding/json库进行反序列化,对CSI进行e2e测试中会遇到如下错误
json: cannot unmarshal number into Go struct field Snapshot.Snapshots.Snapshot.SourceDiskSize of type string
看来在替换前需要先确保Go的类型和json中的类型一致。

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

No branches or pull requests

1 participant