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: add compile tag for json implementation #278

Conversation

welkeyever
Copy link
Member

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.

(Optional) Translate the PR title into Chinese.

增加编译tag控制实际使用的json库

(Optional) More detail description for this PR(en: English/zh: Chinese).

en: Add compile tag for json implementation. Sonic is still used by default, but with a cpu compile check. And its available for users to change the default json lib(sonic) to standard json lib through compile tag: stdjson
zh(optional): 增加编译tag控制json库的选择。Sonic仍然作为默认实现,不过增加了cpu检测(针对不符合sonic要求的cpu自动切换至标准json库)。同时新增了一个编译tag:stdjson 用于主动切换到标准json实现

Which issue(s) this PR fixes:

A better solution to #277

@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Base: 59.89% // Head: 59.97% // Increases project coverage by +0.08% 🎉

Coverage data is based on head (7126c4b) compared to base (f4db636).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 7126c4b differs from pull request most recent head 465dcf8. Consider uploading reports for the commit 465dcf8 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #278      +/-   ##
===========================================
+ Coverage    59.89%   59.97%   +0.08%     
===========================================
  Files           79       79              
  Lines         8158     8158              
===========================================
+ Hits          4886     4893       +7     
+ Misses        2919     2912       -7     
  Partials       353      353              
Impacted Files Coverage Δ
pkg/app/server/binding/binding.go 81.81% <100.00%> (ø)
pkg/app/server/render/json.go 48.14% <100.00%> (ø)
pkg/common/compress/compress.go 83.80% <0.00%> (+2.85%) ⬆️
pkg/common/timer/timer.go 80.95% <0.00%> (+19.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

pkg/common/json/sonic.go Outdated Show resolved Hide resolved
@li-jin-gou
Copy link
Member

li-jin-gou commented Sep 28, 2022

 + 补充文档 https://www.cloudwego.io/zh/docs/hertz/reference/json/

FGYFFFF
FGYFFFF previously approved these changes Sep 28, 2022
@welkeyever
Copy link
Member Author

welkeyever commented Sep 29, 2022

compile tag 的位置规范 gofumpt 和 skywalking license header check 是相互冲突的,暂时忽略这个

@welkeyever welkeyever force-pushed the feat/add_compile_option_to_choose_json_lib branch from cac5ee5 to 465dcf8 Compare September 29, 2022 06:25
@welkeyever welkeyever merged commit e1d8816 into cloudwego:develop Oct 18, 2022
@welkeyever welkeyever deleted the feat/add_compile_option_to_choose_json_lib branch October 18, 2022 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants