Restore template rendering and switch Go internal facts to be rendered. #12501
+450
−351
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.).