Add urfave_cli_no_template build tag #2441
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 212 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.321
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2441"
general
weight: 0.35
kolyshkin
Using
text/templatedisables linker dead code elimination of exported methods for the whole program (golang/go#72895), which can noticeably increase the binary size.This adds
urfave_cli_no_templatebuild tag, which renders the default help and fish completion withouttext/template, producing the same output.Custom templates are not supported in this mode:
RootCommandHelpTemplate,CommandHelpTemplate,SubcommandHelpTemplateandFishCompletionTemplateare short string constants, only used to tell which help is requested, so modifying them is a compile error;CustomRootCommandHelpTemplateorCustomHelpTemplate), it panics. A custom template handled by a customHelpPrinteris fine.With this tag,
examples/example-cliis 3.2 MB instead of 5.1 MB, and runc is 10.5 MB instead of 12.4 MB (with opencontainers/runc#5486 applied, which fixes the only other reason DCE is disabled in runc); all 19 help pages of runc are byte-for-byte identical.Testing:
TestHelpOutput) renders various help pages and fish completion, making sure both modes produce the exact same output;TestNoTemplateTagDCEmakes sure there are no<ReflectMethod>symbols (which disable DCE) inexamples/example-clibuilt with this tag;make check-binary-sizenow also shows the size with this tag.Closes #2277.
_An alternative, in which the template-less rendering code is generated from the templates, was proposed in #2442 (now closed)._