Skip to content

fix: compilation errors due to build cache #16362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged

Conversation

erikburt
Copy link
Collaborator

@erikburt erikburt commented Feb 12, 2025

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.

  • "I don't think disabling the module index should cause any correctness problems."
     export GODEBUG=goindex=0
    

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:

  1. This change - disabling the go module index
  2. Restricting build cache restores
    1. The build cache can restore from caches that are keyed with previous hashes of the go.mod, we could restrict it so it cannot do that. I'm guessing this would also fix the issue.

@erikburt erikburt self-assigned this Feb 12, 2025
@erikburt erikburt marked this pull request as ready for review February 12, 2025 21:27
@erikburt erikburt requested review from a team as code owners February 12, 2025 21:27
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@erikburt erikburt added this pull request to the merge queue Feb 13, 2025
Merged via the queue into develop with commit 52661ac Feb 13, 2025
97 checks passed
@erikburt erikburt deleted the fix/build-caches branch February 13, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants