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

Skip WKT files when exporting #2782

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions private/buf/cmd/buf/command/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/bufbuild/buf/private/buf/bufcli"
"github.com/bufbuild/buf/private/buf/bufctl"
"github.com/bufbuild/buf/private/bufpkg/bufmodule"
"github.com/bufbuild/buf/private/gen/data/datawkt"
"github.com/bufbuild/buf/private/pkg/app/appcmd"
"github.com/bufbuild/buf/private/pkg/app/appext"
"github.com/bufbuild/buf/private/pkg/storage"
Expand Down Expand Up @@ -176,6 +177,10 @@ func run(
return errors.New("no .proto target files found")
}
for _, imageFile := range image.Files() {
if datawkt.Exists(imageFile.Path()) {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't what you want - this will ignore a file if it has the same name as a WKT, regardless of if that file was actually either (1) in your module or (2) an actual dependency. Examples from old CLI that will export the file, but will not after this change:

  • A module with a dep on buf.build/protocolbuffers/wellknowntypes.
  • A module that has a file named google/protobuf/timestamp.proto locally.

Copy link
Member Author

Choose a reason for hiding this comment

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

you're right, I'll fix

Copy link
Member

Choose a reason for hiding this comment

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

Looked into it, fixed in 3c4812b

// export doesn't include WKT files, they're not present in the workspace bucket
continue
}
moduleFile, err := moduleReadBucket.GetFile(ctx, imageFile.Path())
if err != nil {
return err
Expand Down
Loading