Skip to content

Restore template rendering and switch Go internal facts to be rendered.#12501

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test/cl855438795
Jan 26, 2026
Merged

Restore template rendering and switch Go internal facts to be rendered.#12501
copybara-service[bot] merged 1 commit intomasterfrom
test/cl855438795

Conversation

@copybara-service
Copy link
Copy Markdown

Restore template rendering and switch Go internal facts to be rendered.

Since switching to checkconst style static analysis for constants imported from
Go internal pkgs, we've seen a proliferation of duplicate files for various Go
versions. This is not an ideal state of affairs, and results in needless time
spent keeping Go and gVisor in sync WRT to these constants.

To fix this problem, this CL restores template rendering. Instead of going back
to the original implementation where we had separate .tmpl files, this CL uses
Adin's unused implementation of integrating template generation into Go
comments. This allows these files to be parsed as normal by other tools, and
results in not needing separate nogo_facts blaze targets just for template
files.

For simplicity and versatility I have decided to retain the checkconst
annotations. While there don't seem to be that many cases where having
+checkconst annotations over rendering is an improvement (one such case is in
runtime_go12\d_unsafe.go) there may be other such cases in the future. The
template rendering is done via the checkconst analyzer, so there is no redundant
information.

This CL mainly focuses on removing duplicate files per Go version, so other uses
of checkconst annotations that reference internal gvisor pkgs are kept as-is
(e.g. bluepill_..s, entry_..s, etc.).

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Jan 16, 2026
@copybara-service copybara-service Bot force-pushed the test/cl855438795 branch 5 times, most recently from 88a3084 to ac25fd2 Compare January 22, 2026 21:50
@copybara-service copybara-service Bot force-pushed the test/cl855438795 branch 4 times, most recently from 4f230b0 to 3afa909 Compare January 26, 2026 19:36
Since switching to checkconst style static analysis for constants imported from
Go internal pkgs, we've seen a proliferation of duplicate files for various Go
versions. This is not an ideal state of affairs, and results in needless time
spent keeping Go and gVisor in sync WRT to these constants.

To fix this problem, this CL restores template rendering. Instead of going back
to the original implementation where we had separate .tmpl files, this CL uses
Adin's unused implementation of integrating template generation into Go
comments. This allows these files to be parsed as normal by other tools, and
results in not needing separate nogo_facts blaze targets just for template
files.

For simplicity and versatility I have decided to retain the checkconst
annotations. While there don't seem to be that many cases where having
+checkconst annotations over rendering is an improvement (one such case is in
runtime_go12\d_unsafe.go) there may be other such cases in the future.  The
template rendering is done via the checkconst analyzer, so there is no redundant
information.

This CL mainly focuses on removing duplicate files per Go version, so other uses
of checkconst annotations that reference internal gvisor pkgs are kept as-is
(e.g. bluepill_.*.s, entry_.*.s, etc.).

PiperOrigin-RevId: 861305642
@copybara-service copybara-service Bot merged commit d58e3b1 into master Jan 26, 2026
@copybara-service copybara-service Bot deleted the test/cl855438795 branch January 26, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant