bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.38k stars 656 forks source link

[rules_go] show x archive isn't stable to package interface #4143

Open joeljeske opened 1 day ago

joeljeske commented 1 day ago

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.