[rules_go] show x archive isn't stable to package interface #4143
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.
What type of PR is this?
Other - adding test case proving x archive isn't stable as intended
related to #4111
How to Use
Run
bazel run //tests/core/go_library/reproducible_x:show_not_reproducible
to build a go_library and hash the .x archive, and then to modify the implementation slightly, but not to change the package interface and expect the resulting .x hash to remain constant.It was suggested that a sufficiently simple test case could result in source code being inlined into callers and thus modifying the resulting x archive, so I grabbed a "calculator" file to demonstrate sufficiently complex code that should result in a stable interface. In my tests, the resulting archive is not stable.