CodeChain-io / CodeChain-io/codechain-sdk-go

Use custom JSON marshal instead of object duplication

未关闭
#54 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
5
派生
4
PR 合并指标
30 天内没有已合并 PR

描述

Currently, some of the Transaction-related objects have two forms, which implement normal type and for marshaling.

https://github.com/CodeChain-io/codechain-sdk-go/blob/6ad3e76c4dfba22b0867764b8c67500dce7518d2/core/transaction/signedTransaction.go#L11-L17
https://github.com/CodeChain-io/codechain-sdk-go/blob/6ad3e76c4dfba22b0867764b8c67500dce7518d2/core/transaction/signedTransaction.go#L19-L25

This implementation is from [codechain-sdk-js](https://github.com/CodeChain-io/codechain-sdk-js).
But since golang can implement custom marshaling function ([link1](http://choly.ca/post/go-json-marshalling/
)) ([link2](https://play.golang.org/p/CTmJhTiGAM)), I think duplication of the objects is unnecessary.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with core/transaction/signedTransaction.go, especially the linked lines showing the normal and marshaling-specific forms. Compare the duplicated Transaction-related objects and review Go's custom JSON marshaling approach. Done means the duplicate object forms are replaced where appropriate while preserving the existing JSON output.

由索引模型根据 Issue 内容生成。

评估

技术栈
go
领域
backend-api-design
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。