Skip to content
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

Go: Prevent go.mod files from being added to every directory with stray source files #16727

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

mbg
Copy link
Member

@mbg mbg commented Jun 11, 2024

Summary

This PR fixes another bug in the Go autobuilder which I discovered while testing the fix implemented in #16704. Specifically, for an old commit of a repository that didn't use Go modules (except for one in a deeply nested directory), the autobuilder ended up initialising go.mod files in every directory containing stray Go source files. This PR fixes this to only initialise them in as few directories, as far up the directory hierarchy as possible.

@mbg mbg self-assigned this Jun 11, 2024
@github-actions github-actions bot added the Go label Jun 11, 2024
Base automatically changed from mbg/go/fix/build-scripts-running-more-than-once to main June 11, 2024 21:23
@mbg mbg marked this pull request as ready for review June 14, 2024 08:30
@mbg mbg requested a review from a team as a code owner June 14, 2024 08:30
@mbg
Copy link
Member Author

mbg commented Jun 14, 2024

The results of the QA experiment for this look good (note that they are combined with the changes from #16704).

@mbg
Copy link
Member Author

mbg commented Jun 14, 2024

I also tested this locally on the old commit of kubernetes that was causing problems and the issue is resolved there now.

Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks highly plausible, though I must admit I didn't do the most thorough review..

@mbg mbg merged commit 039537f into main Jun 14, 2024
10 checks passed
@mbg mbg deleted the mbg/go/fix/too-many-go-mod-files-initialised branch June 14, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants