From ee6ab70527507e97da32a684a29d90df8a892eca Mon Sep 17 00:00:00 2001 From: bufdev Date: Fri, 2 Feb 2024 14:21:45 -0500 Subject: [PATCH] Move proto/buf to buf and add ioext.CompositeReadWriteCloser --- buf.work.yaml | 2 +- make/buf/all.mk | 4 ++-- private/pkg/ioext/ioext.go | 11 +++++++++++ proto/{buf => }/LICENSE | 0 proto/{buf => }/buf.yaml | 0 proto/buf/{buf => }/alpha/audit/v1alpha1/event.proto | 0 .../buf/{buf => }/alpha/audit/v1alpha1/service.proto | 0 proto/buf/{buf => }/alpha/breaking/v1/config.proto | 0 proto/buf/{buf => }/alpha/image/v1/image.proto | 0 proto/buf/{buf => }/alpha/lint/v1/config.proto | 0 .../buf/{buf => }/alpha/module/v1alpha1/module.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/admin.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/authn.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/authz.proto | 0 .../{buf => }/alpha/registry/v1alpha1/convert.proto | 0 .../{buf => }/alpha/registry/v1alpha1/display.proto | 0 proto/buf/{buf => }/alpha/registry/v1alpha1/doc.proto | 0 .../{buf => }/alpha/registry/v1alpha1/download.proto | 0 .../alpha/registry/v1alpha1/git_metadata.proto | 0 .../{buf => }/alpha/registry/v1alpha1/github.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/image.proto | 0 .../alpha/registry/v1alpha1/jsonschema.proto | 0 .../{buf => }/alpha/registry/v1alpha1/labels.proto | 0 .../{buf => }/alpha/registry/v1alpha1/module.proto | 0 .../alpha/registry/v1alpha1/organization.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/owner.proto | 0 .../alpha/registry/v1alpha1/plugin_curation.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/push.proto | 0 .../alpha/registry/v1alpha1/recommendation.proto | 0 .../{buf => }/alpha/registry/v1alpha1/reference.proto | 0 .../alpha/registry/v1alpha1/repository.proto | 0 .../alpha/registry/v1alpha1/repository_branch.proto | 0 .../alpha/registry/v1alpha1/repository_commit.proto | 0 .../alpha/registry/v1alpha1/repository_tag.proto | 0 .../{buf => }/alpha/registry/v1alpha1/resolve.proto | 0 .../{buf => }/alpha/registry/v1alpha1/resource.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/role.proto | 0 .../{buf => }/alpha/registry/v1alpha1/schema.proto | 0 .../alpha/registry/v1alpha1/scim_token.proto | 0 .../{buf => }/alpha/registry/v1alpha1/search.proto | 0 .../{buf => }/alpha/registry/v1alpha1/studio.proto | 0 .../alpha/registry/v1alpha1/studio_request.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/sync.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/token.proto | 0 .../buf/{buf => }/alpha/registry/v1alpha1/user.proto | 0 .../alpha/registry/v1alpha1/verification_status.proto | 0 .../{buf => }/alpha/registry/v1alpha1/webhook.proto | 0 .../buf/{buf => }/alpha/studio/v1alpha1/invoke.proto | 0 .../{buf => }/alpha/wasmplugin/v1/wasmplugin.proto | 0 .../buf/{buf => }/alpha/webhook/v1alpha1/event.proto | 0 50 files changed, 14 insertions(+), 3 deletions(-) rename proto/{buf => }/LICENSE (100%) rename proto/{buf => }/buf.yaml (100%) rename proto/buf/{buf => }/alpha/audit/v1alpha1/event.proto (100%) rename proto/buf/{buf => }/alpha/audit/v1alpha1/service.proto (100%) rename proto/buf/{buf => }/alpha/breaking/v1/config.proto (100%) rename proto/buf/{buf => }/alpha/image/v1/image.proto (100%) rename proto/buf/{buf => }/alpha/lint/v1/config.proto (100%) rename proto/buf/{buf => }/alpha/module/v1alpha1/module.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/admin.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/authn.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/authz.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/convert.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/display.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/doc.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/download.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/git_metadata.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/github.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/image.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/jsonschema.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/labels.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/module.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/organization.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/owner.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/plugin_curation.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/push.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/recommendation.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/reference.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/repository.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/repository_branch.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/repository_commit.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/repository_tag.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/resolve.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/resource.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/role.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/schema.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/scim_token.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/search.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/studio.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/studio_request.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/sync.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/token.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/user.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/verification_status.proto (100%) rename proto/buf/{buf => }/alpha/registry/v1alpha1/webhook.proto (100%) rename proto/buf/{buf => }/alpha/studio/v1alpha1/invoke.proto (100%) rename proto/buf/{buf => }/alpha/wasmplugin/v1/wasmplugin.proto (100%) rename proto/buf/{buf => }/alpha/webhook/v1alpha1/event.proto (100%) diff --git a/buf.work.yaml b/buf.work.yaml index 7053a4dd60..1878b341be 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -1,3 +1,3 @@ version: v1 directories: - - proto/buf + - proto diff --git a/make/buf/all.mk b/make/buf/all.mk index 825b47ac11..b21d393a5c 100644 --- a/make/buf/all.mk +++ b/make/buf/all.mk @@ -123,12 +123,12 @@ bufgenerateclean:: \ .PHONY: bufgenerateprotogo bufgenerateprotogo: - $(BUF_BIN) generate proto/buf --template data/template/buf.go.gen.yaml + $(BUF_BIN) generate proto --template data/template/buf.go.gen.yaml $(BUF_BIN) generate buf.build/grpc/grpc --type grpc.reflection.v1.ServerReflection --template data/template/buf.go.gen.yaml .PHONY: bufgenerateprotogoclient bufgenerateprotogoclient: - $(BUF_BIN) generate proto/buf --template data/template/buf.go-client.gen.yaml + $(BUF_BIN) generate proto --template data/template/buf.go-client.gen.yaml .PHONY: bufgeneratebuflinttestdata bufgeneratebuflinttestdata: diff --git a/private/pkg/ioext/ioext.go b/private/pkg/ioext/ioext.go index ad7ac98134..dd0676fb7c 100644 --- a/private/pkg/ioext/ioext.go +++ b/private/pkg/ioext/ioext.go @@ -60,6 +60,11 @@ func CompositeWriteCloser(writer io.Writer, closer io.Closer) io.WriteCloser { return compositeWriteCloser{Writer: writer, Closer: closer} } +// CompositeReadWriteCloser returns a io.ReadWriteCloser that is a composite of the Reader, Writer, and Closer. +func CompositeReadWriteCloser(reader io.Reader, writer io.Writer, closer io.Closer) io.ReadWriteCloser { + return compositeReadWriteCloser{Reader: reader, Writer: writer, Closer: closer} +} + // ChainCloser chains the closers by calling them in order. func ChainCloser(closers ...io.Closer) io.Closer { return chainCloser{closers: closers} @@ -119,6 +124,12 @@ type compositeWriteCloser struct { io.Closer } +type compositeReadWriteCloser struct { + io.Reader + io.Writer + io.Closer +} + type chainCloser struct { closers []io.Closer } diff --git a/proto/buf/LICENSE b/proto/LICENSE similarity index 100% rename from proto/buf/LICENSE rename to proto/LICENSE diff --git a/proto/buf/buf.yaml b/proto/buf.yaml similarity index 100% rename from proto/buf/buf.yaml rename to proto/buf.yaml diff --git a/proto/buf/buf/alpha/audit/v1alpha1/event.proto b/proto/buf/alpha/audit/v1alpha1/event.proto similarity index 100% rename from proto/buf/buf/alpha/audit/v1alpha1/event.proto rename to proto/buf/alpha/audit/v1alpha1/event.proto diff --git a/proto/buf/buf/alpha/audit/v1alpha1/service.proto b/proto/buf/alpha/audit/v1alpha1/service.proto similarity index 100% rename from proto/buf/buf/alpha/audit/v1alpha1/service.proto rename to proto/buf/alpha/audit/v1alpha1/service.proto diff --git a/proto/buf/buf/alpha/breaking/v1/config.proto b/proto/buf/alpha/breaking/v1/config.proto similarity index 100% rename from proto/buf/buf/alpha/breaking/v1/config.proto rename to proto/buf/alpha/breaking/v1/config.proto diff --git a/proto/buf/buf/alpha/image/v1/image.proto b/proto/buf/alpha/image/v1/image.proto similarity index 100% rename from proto/buf/buf/alpha/image/v1/image.proto rename to proto/buf/alpha/image/v1/image.proto diff --git a/proto/buf/buf/alpha/lint/v1/config.proto b/proto/buf/alpha/lint/v1/config.proto similarity index 100% rename from proto/buf/buf/alpha/lint/v1/config.proto rename to proto/buf/alpha/lint/v1/config.proto diff --git a/proto/buf/buf/alpha/module/v1alpha1/module.proto b/proto/buf/alpha/module/v1alpha1/module.proto similarity index 100% rename from proto/buf/buf/alpha/module/v1alpha1/module.proto rename to proto/buf/alpha/module/v1alpha1/module.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/admin.proto b/proto/buf/alpha/registry/v1alpha1/admin.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/admin.proto rename to proto/buf/alpha/registry/v1alpha1/admin.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/authn.proto b/proto/buf/alpha/registry/v1alpha1/authn.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/authn.proto rename to proto/buf/alpha/registry/v1alpha1/authn.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/authz.proto b/proto/buf/alpha/registry/v1alpha1/authz.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/authz.proto rename to proto/buf/alpha/registry/v1alpha1/authz.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/convert.proto b/proto/buf/alpha/registry/v1alpha1/convert.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/convert.proto rename to proto/buf/alpha/registry/v1alpha1/convert.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/display.proto b/proto/buf/alpha/registry/v1alpha1/display.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/display.proto rename to proto/buf/alpha/registry/v1alpha1/display.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/doc.proto b/proto/buf/alpha/registry/v1alpha1/doc.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/doc.proto rename to proto/buf/alpha/registry/v1alpha1/doc.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/download.proto b/proto/buf/alpha/registry/v1alpha1/download.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/download.proto rename to proto/buf/alpha/registry/v1alpha1/download.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/git_metadata.proto b/proto/buf/alpha/registry/v1alpha1/git_metadata.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/git_metadata.proto rename to proto/buf/alpha/registry/v1alpha1/git_metadata.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/github.proto b/proto/buf/alpha/registry/v1alpha1/github.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/github.proto rename to proto/buf/alpha/registry/v1alpha1/github.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/image.proto b/proto/buf/alpha/registry/v1alpha1/image.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/image.proto rename to proto/buf/alpha/registry/v1alpha1/image.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/jsonschema.proto b/proto/buf/alpha/registry/v1alpha1/jsonschema.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/jsonschema.proto rename to proto/buf/alpha/registry/v1alpha1/jsonschema.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/labels.proto b/proto/buf/alpha/registry/v1alpha1/labels.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/labels.proto rename to proto/buf/alpha/registry/v1alpha1/labels.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/module.proto b/proto/buf/alpha/registry/v1alpha1/module.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/module.proto rename to proto/buf/alpha/registry/v1alpha1/module.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/organization.proto b/proto/buf/alpha/registry/v1alpha1/organization.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/organization.proto rename to proto/buf/alpha/registry/v1alpha1/organization.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/owner.proto b/proto/buf/alpha/registry/v1alpha1/owner.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/owner.proto rename to proto/buf/alpha/registry/v1alpha1/owner.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/plugin_curation.proto b/proto/buf/alpha/registry/v1alpha1/plugin_curation.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/plugin_curation.proto rename to proto/buf/alpha/registry/v1alpha1/plugin_curation.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/push.proto b/proto/buf/alpha/registry/v1alpha1/push.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/push.proto rename to proto/buf/alpha/registry/v1alpha1/push.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/recommendation.proto b/proto/buf/alpha/registry/v1alpha1/recommendation.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/recommendation.proto rename to proto/buf/alpha/registry/v1alpha1/recommendation.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/reference.proto b/proto/buf/alpha/registry/v1alpha1/reference.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/reference.proto rename to proto/buf/alpha/registry/v1alpha1/reference.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/repository.proto b/proto/buf/alpha/registry/v1alpha1/repository.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/repository.proto rename to proto/buf/alpha/registry/v1alpha1/repository.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/repository_branch.proto b/proto/buf/alpha/registry/v1alpha1/repository_branch.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/repository_branch.proto rename to proto/buf/alpha/registry/v1alpha1/repository_branch.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/repository_commit.proto b/proto/buf/alpha/registry/v1alpha1/repository_commit.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/repository_commit.proto rename to proto/buf/alpha/registry/v1alpha1/repository_commit.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/repository_tag.proto b/proto/buf/alpha/registry/v1alpha1/repository_tag.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/repository_tag.proto rename to proto/buf/alpha/registry/v1alpha1/repository_tag.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/resolve.proto b/proto/buf/alpha/registry/v1alpha1/resolve.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/resolve.proto rename to proto/buf/alpha/registry/v1alpha1/resolve.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/resource.proto b/proto/buf/alpha/registry/v1alpha1/resource.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/resource.proto rename to proto/buf/alpha/registry/v1alpha1/resource.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/role.proto b/proto/buf/alpha/registry/v1alpha1/role.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/role.proto rename to proto/buf/alpha/registry/v1alpha1/role.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/schema.proto b/proto/buf/alpha/registry/v1alpha1/schema.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/schema.proto rename to proto/buf/alpha/registry/v1alpha1/schema.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/scim_token.proto b/proto/buf/alpha/registry/v1alpha1/scim_token.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/scim_token.proto rename to proto/buf/alpha/registry/v1alpha1/scim_token.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/search.proto b/proto/buf/alpha/registry/v1alpha1/search.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/search.proto rename to proto/buf/alpha/registry/v1alpha1/search.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/studio.proto b/proto/buf/alpha/registry/v1alpha1/studio.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/studio.proto rename to proto/buf/alpha/registry/v1alpha1/studio.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/studio_request.proto b/proto/buf/alpha/registry/v1alpha1/studio_request.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/studio_request.proto rename to proto/buf/alpha/registry/v1alpha1/studio_request.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/sync.proto b/proto/buf/alpha/registry/v1alpha1/sync.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/sync.proto rename to proto/buf/alpha/registry/v1alpha1/sync.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/token.proto b/proto/buf/alpha/registry/v1alpha1/token.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/token.proto rename to proto/buf/alpha/registry/v1alpha1/token.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/user.proto b/proto/buf/alpha/registry/v1alpha1/user.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/user.proto rename to proto/buf/alpha/registry/v1alpha1/user.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/verification_status.proto b/proto/buf/alpha/registry/v1alpha1/verification_status.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/verification_status.proto rename to proto/buf/alpha/registry/v1alpha1/verification_status.proto diff --git a/proto/buf/buf/alpha/registry/v1alpha1/webhook.proto b/proto/buf/alpha/registry/v1alpha1/webhook.proto similarity index 100% rename from proto/buf/buf/alpha/registry/v1alpha1/webhook.proto rename to proto/buf/alpha/registry/v1alpha1/webhook.proto diff --git a/proto/buf/buf/alpha/studio/v1alpha1/invoke.proto b/proto/buf/alpha/studio/v1alpha1/invoke.proto similarity index 100% rename from proto/buf/buf/alpha/studio/v1alpha1/invoke.proto rename to proto/buf/alpha/studio/v1alpha1/invoke.proto diff --git a/proto/buf/buf/alpha/wasmplugin/v1/wasmplugin.proto b/proto/buf/alpha/wasmplugin/v1/wasmplugin.proto similarity index 100% rename from proto/buf/buf/alpha/wasmplugin/v1/wasmplugin.proto rename to proto/buf/alpha/wasmplugin/v1/wasmplugin.proto diff --git a/proto/buf/buf/alpha/webhook/v1alpha1/event.proto b/proto/buf/alpha/webhook/v1alpha1/event.proto similarity index 100% rename from proto/buf/buf/alpha/webhook/v1alpha1/event.proto rename to proto/buf/alpha/webhook/v1alpha1/event.proto