Skip to content

Conversation

@copybara-service
Copy link

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 2 times, most recently from 6f30401 to 1d089ff Compare January 21, 2026 18:45
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: 855438795
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