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

feat: Optimize Encoding Functions and Add Descriptive Comments #3543

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

cubxxw
Copy link
Contributor

@cubxxw cubxxw commented Sep 5, 2023

This pull request introduces several improvements to the encoding package:

  1. Refactoring for Code Reusability: Introduced encodeToJSON to handle the encoding of TOML and YAML data to JSON, reducing duplicated code between TomlToJson and YamlToJson.
  2. Clearer Commenting: Added English comments to each function for better clarity on its purpose and functionality.
  3. Enhanced Key Processing: Updated functions related to key processing (convertKeyToString and toStringKeyMap) to ensure more consistent handling and conversion, particularly for ensuring map keys are of string type.

This pull request introduces several improvements to the encoding package:

1. **Refactoring for Code Reusability**: Introduced `encodeToJSON` to handle the encoding of TOML and YAML data to JSON, reducing duplicated code between `TomlToJson` and `YamlToJson`.
2. **Clearer Commenting**: Added English comments to each function for better clarity on its purpose and functionality.
3. **Enhanced Key Processing**: Updated functions related to key processing (`convertKeyToString` and `toStringKeyMap`) to ensure more consistent handling and conversion, particularly for ensuring map keys are of string type.

These changes aim to improve the readability, maintainability, and efficiency of the code in the `encoding` package. Feedback or suggestions for further refinements are welcome!
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Merging #3543 (da282a0) into master (69a3024) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Files Changed Coverage Δ
internal/encoding/encoding.go 88.88% <100.00%> (+5.55%) ⬆️

Copy link
Contributor

@kevwan kevwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kevwan kevwan added this pull request to the merge queue Sep 6, 2023
Merged via the queue into zeromicro:master with commit ca5a7df Sep 6, 2023
7 checks passed
@cubxxw cubxxw deleted the patch-1 branch September 6, 2023 14:32
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.

None yet

2 participants