fix: compilation errors due to build cache #16362
Merged
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.
We have seen compilation errors multiple times. This is seemingly due to a weird edge case with build caches.
Examples:
Solution
After coming across golang/go#69179. Seems like its the module index that is not being handled properly in certain cases when restoring the build cache.
Further Notes
From what I understand the build cache uses a module index to resolve modules during the build step. If that module index doesn't correspond to the go module cache properly (ie. a
go.mod
was updated after the build cache was populated) then the index may map improperly causing compilation errors.The two solutions I see for this is:
go.mod
, we could restrict it so it cannot do that. I'm guessing this would also fix the issue.