Skip to content

Conversation

@eat-swap
Copy link

What type of PR is this?

fix

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.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

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

en: In generic call of thrift protocol, the tool does not accept some basic go types such as int and int-based maps (like map[int32]interface{}). This PR make the tool accepting them.
zh(optional): 修复 thrift 泛化调用不接受诸如 int, map[int32]interface{} 这样的基础 go 类型

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@eat-swap eat-swap requested review from a team as code owners January 15, 2026 15:16
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 0% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.52%. Comparing base (bfa27f3) to head (afb22bf).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
pkg/generic/thrift/write.go 0.00% 60 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (bfa27f3) and HEAD (afb22bf). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (bfa27f3) HEAD (afb22bf)
unit 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1910      +/-   ##
==========================================
- Coverage   61.37%   51.52%   -9.86%     
==========================================
  Files         388      324      -64     
  Lines       35063    22663   -12400     
==========================================
- Hits        21521    11677    -9844     
+ Misses      12247     9670    -2577     
- Partials     1295     1316      +21     
Flag Coverage Δ
integration 51.52% <0.00%> (+1.02%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return fmt.Errorf("need int type, but got: %s", t.Type)
}

func writeInt(ctx context.Context, val interface{}, out *thrift.BufferWriter, t *descriptor.TypeDescriptor, opt *writerOption) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里val也用模板呗。然后顺便把之前写的一堆 writeInt16代码整合到这里面

Copy link
Author

Choose a reason for hiding this comment

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

问题比较大,换成模板之后在 int32 的 case 有 2%-3% 的劣化,int64 有 3%-4% 的劣化,根源是做 T 的 type assertion 的时候多一个去寄存器拿 T 的步骤

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.

3 participants