Skip to content

Fix buf generate clean to not delete nested output#4615

Open
doriable wants to merge 1 commit into
mainfrom
fix-buf-generate-clean
Open

Fix buf generate clean to not delete nested output#4615
doriable wants to merge 1 commit into
mainfrom
fix-buf-generate-clean

Conversation

@doriable

@doriable doriable commented Jul 13, 2026

Copy link
Copy Markdown
Member

This PR fixes an issue where if a plugin writes to
the child directory of another plugin's out directory,
the file will end up being cleaned, since it is not part
of the latter plugin's output.

Instead of tracking per-directory by individual buckets
for each plugin's generated output, we track the full paths
of all generated files, and then clean based on that. A test
case has also been added for this.

@doriable doriable requested review from pkwarren and timostamm July 13, 2026 18:01
@github-actions

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 13, 2026, 6:02 PM

// directories in dirOutputPaths that are nested under parentDir. Both
// parentDir and the map keys are OS-native absolute paths; the returned
// paths are normalized (forward slashes) for use with storage bucket paths.
func nestedOutputDirs(parentDir string, dirOutputPaths map[string]map[string]struct{}) map[string]struct{} {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice.

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.

2 participants