Skip to content

fix: strip debug symbols from release binaries - #464

Merged
miclle merged 1 commit into
masterfrom
fennoai/issue-421-1793262114
Nov 6, 2026
Merged

miclle merged 1 commit into
masterfrom
fennoai/issue-421-1793262114

Conversation

@fennoai

@fennoai fennoai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Requested by @Nliver

发布二进制此前保留了符号表和 DWARF 调试信息,导致下载及解压后的文件偏大。为 Makefile、发布前构建检查和正式发布统一加入 Go 链接参数 -s -w,保留版本号注入和静态链接参数,并更新变更日志。

Closes #421

验证结果:

  • Linux amd64 实际构建对比:34,461,145 → 24,281,272 字节,缩小 29.54%。
  • readelf 确认不含符号表和 DWARF 调试段;version 正确输出注入值,--help 正常运行。
  • make -Bn all 检查全部 16 个平台目标均带有 -s -w 和版本号参数;发布检查与正式发布的链接参数一致。
  • make test、go vet ./...、gofmt -s -l . 和 git diff --check 通过。
  • make lint 在 staticcheck 阶段因未修改 Go 文件中的既有问题失败,包括弃用的 io/ioutil、未使用代码及 SA4006;本次未改动 Go 源码。

本地实际构建验证覆盖 Linux amd64,其余平台检查了生成的构建命令;未执行正式发布。

@qiniu-prow

qiniu-prow Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Hi @fennoai[bot]. Thanks for your PR.

I'm waiting for a qiniu member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@qiniu-prow qiniu-prow Bot added the size/S label Oct 29, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No reportable defects were found across the three changed files. Linker argument grouping was validated for all 16 Makefile targets, and isolated Linux, macOS, and Windows builds passed; native execution confirmed version injection and panic stack traces remain intact. Full application build verification was blocked by uncached dependencies.

Reviewed head commit: 9fb2fd8b096f3ddbbf470b15eddf61c50fff04b9

@qiniu-prow

qiniu-prow Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: fennoai[bot]

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@miclle
miclle merged commit 037912c into master Nov 6, 2026
20 of 21 checks passed
@miclle
miclle deleted the fennoai/issue-421-1793262114 branch November 6, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

建议strip掉二进制文件中的调制符号

2 participants