Skip to content

Suggestion to Upgrade the "clean" Option in buf.gen.yaml to Specify Explicit Paths #4205

@nemo1105

Description

@nemo1105

Feature

I've written a local buf plugin that generates empty Connect implementation files from .proto definitions. Whenever I define a new RPC method, I simply run the proto compilation again, and it automatically generates a corresponding empty implementation for the new RPC.

Currently, if I set clean: true, all previously generated RPC implementations are deleted and regenerated from scratch. However, I'd also like certain directories that contain basic structural definitions generated from proto—such as the protocol directory—to be cleaned on every compilation (e.g., in case I've deleted a .proto file and want its generated artifacts removed too).

It would be ideal if I could configure the clean option in buf.gen.yaml like this:

clean:
  - protocol

That would solve the problem perfectly. After all, when using protoc directly, it's quite straightforward to customize whether or not to delete files in the output directory. If buf aims to offer a superior developer experience, I’d suggest avoiding overly restrictive defaults and allowing more flexibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions