From 879f00c0b76a00ece0e0cfd9539d8291630bf4d7 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Mon, 30 Oct 2023 10:06:06 -0500 Subject: [PATCH] Add go_package to all .proto files In order to ensure that all generated code comes from the correct package, add the go_package option (similar to protovalidate) to all .proto files. This should also serve as a reminder for users that generated registry code should come from generated SDKs. --- buf/registry/module/v1beta1/branch.proto | 2 ++ buf/registry/module/v1beta1/branch_service.proto | 2 ++ buf/registry/module/v1beta1/commit.proto | 2 ++ buf/registry/module/v1beta1/commit_service.proto | 2 ++ buf/registry/module/v1beta1/module.proto | 2 ++ buf/registry/module/v1beta1/module_service.proto | 2 ++ buf/registry/module/v1beta1/resource.proto | 2 ++ buf/registry/module/v1beta1/tag.proto | 2 ++ buf/registry/module/v1beta1/tag_service.proto | 2 ++ buf/registry/module/v1beta1/vcs_commit.proto | 2 ++ buf/registry/module/v1beta1/vcs_commit_service.proto | 2 ++ buf/registry/owner/v1beta1/organization.proto | 2 ++ buf/registry/owner/v1beta1/organization_service.proto | 2 ++ buf/registry/owner/v1beta1/owner.proto | 2 ++ buf/registry/owner/v1beta1/owner_service.proto | 2 ++ buf/registry/owner/v1beta1/user.proto | 2 ++ buf/registry/owner/v1beta1/user_service.proto | 2 ++ buf/registry/priv/extension/v1beta1/extension.proto | 2 ++ buf/registry/storage/v1beta1/storage.proto | 2 ++ 19 files changed, 38 insertions(+) diff --git a/buf/registry/module/v1beta1/branch.proto b/buf/registry/module/v1beta1/branch.proto index 0b8e97e..143c342 100644 --- a/buf/registry/module/v1beta1/branch.proto +++ b/buf/registry/module/v1beta1/branch.proto @@ -21,6 +21,8 @@ import "buf/registry/storage/v1beta1/storage.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // A branch on a specific Module. message Branch { option (buf.registry.priv.extension.v1beta1.message).response_only = true; diff --git a/buf/registry/module/v1beta1/branch_service.proto b/buf/registry/module/v1beta1/branch_service.proto index 877cb2d..f8cabd6 100644 --- a/buf/registry/module/v1beta1/branch_service.proto +++ b/buf/registry/module/v1beta1/branch_service.proto @@ -21,6 +21,8 @@ import "buf/registry/module/v1beta1/module.proto"; import "buf/registry/module/v1beta1/resource.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // Operate on Branches. service BranchService { // Get Branches by ID or name. diff --git a/buf/registry/module/v1beta1/commit.proto b/buf/registry/module/v1beta1/commit.proto index 7f47d1d..628c748 100644 --- a/buf/registry/module/v1beta1/commit.proto +++ b/buf/registry/module/v1beta1/commit.proto @@ -21,6 +21,8 @@ import "buf/registry/storage/v1beta1/storage.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // A commit on a specific module. // // Commits can be associated with multiple Branches. diff --git a/buf/registry/module/v1beta1/commit_service.proto b/buf/registry/module/v1beta1/commit_service.proto index f346a4d..831aa9c 100644 --- a/buf/registry/module/v1beta1/commit_service.proto +++ b/buf/registry/module/v1beta1/commit_service.proto @@ -22,6 +22,8 @@ import "buf/registry/module/v1beta1/vcs_commit.proto"; import "buf/registry/storage/v1beta1/storage.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // Operate on Commits. service CommitService { // Resolve commits by Commit ID, Module, Branch, Tag, or VCSCommit. diff --git a/buf/registry/module/v1beta1/module.proto b/buf/registry/module/v1beta1/module.proto index e43a39b..aba2f65 100644 --- a/buf/registry/module/v1beta1/module.proto +++ b/buf/registry/module/v1beta1/module.proto @@ -20,6 +20,8 @@ import "buf/registry/priv/extension/v1beta1/extension.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // A module within the BSR. message Module { option (buf.registry.priv.extension.v1beta1.message).response_only = true; diff --git a/buf/registry/module/v1beta1/module_service.proto b/buf/registry/module/v1beta1/module_service.proto index a17a470..fbeef85 100644 --- a/buf/registry/module/v1beta1/module_service.proto +++ b/buf/registry/module/v1beta1/module_service.proto @@ -20,6 +20,8 @@ import "buf/registry/module/v1beta1/module.proto"; import "buf/registry/owner/v1beta1/owner.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // Operate on Modules. service ModuleService { // Get Modules by id or name. diff --git a/buf/registry/module/v1beta1/resource.proto b/buf/registry/module/v1beta1/resource.proto index 2ae6db7..c315aa8 100644 --- a/buf/registry/module/v1beta1/resource.proto +++ b/buf/registry/module/v1beta1/resource.proto @@ -19,6 +19,8 @@ package buf.registry.module.v1beta1; import "buf/registry/priv/extension/v1beta1/extension.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // A reference to any of these resources: // - Module // - Commit diff --git a/buf/registry/module/v1beta1/tag.proto b/buf/registry/module/v1beta1/tag.proto index bc6e7cc..8f25754 100644 --- a/buf/registry/module/v1beta1/tag.proto +++ b/buf/registry/module/v1beta1/tag.proto @@ -21,6 +21,8 @@ import "buf/registry/storage/v1beta1/storage.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // A tag on a specific Module. // // Many Tags can be associated with a single Commit. diff --git a/buf/registry/module/v1beta1/tag_service.proto b/buf/registry/module/v1beta1/tag_service.proto index 16fe467..6482cb0 100644 --- a/buf/registry/module/v1beta1/tag_service.proto +++ b/buf/registry/module/v1beta1/tag_service.proto @@ -21,6 +21,8 @@ import "buf/registry/module/v1beta1/resource.proto"; import "buf/registry/module/v1beta1/tag.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // Operate on Tags. service TagService { // Get Tags by id or name. diff --git a/buf/registry/module/v1beta1/vcs_commit.proto b/buf/registry/module/v1beta1/vcs_commit.proto index 672319d..4bd60d8 100644 --- a/buf/registry/module/v1beta1/vcs_commit.proto +++ b/buf/registry/module/v1beta1/vcs_commit.proto @@ -21,6 +21,8 @@ import "buf/registry/storage/v1beta1/storage.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // VCSCommit is a commit from a specific VCS associated with a specific Module. // // Many VCSCommits can be associated with a single Commit. diff --git a/buf/registry/module/v1beta1/vcs_commit_service.proto b/buf/registry/module/v1beta1/vcs_commit_service.proto index 9471421..ca22353 100644 --- a/buf/registry/module/v1beta1/vcs_commit_service.proto +++ b/buf/registry/module/v1beta1/vcs_commit_service.proto @@ -20,6 +20,8 @@ import "buf/registry/module/v1beta1/resource.proto"; import "buf/registry/module/v1beta1/vcs_commit.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1"; + // Operate on VCSCommits. service VCSCommitService { // Get VCSCommits by id or name. diff --git a/buf/registry/owner/v1beta1/organization.proto b/buf/registry/owner/v1beta1/organization.proto index f2e7ba1..ba8ee05 100644 --- a/buf/registry/owner/v1beta1/organization.proto +++ b/buf/registry/owner/v1beta1/organization.proto @@ -20,6 +20,8 @@ import "buf/registry/priv/extension/v1beta1/extension.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // Organization is an organization on the BSR. // // A name uniquely identifies an Organization, however name is mutable. diff --git a/buf/registry/owner/v1beta1/organization_service.proto b/buf/registry/owner/v1beta1/organization_service.proto index ffe68ac..cda5dc8 100644 --- a/buf/registry/owner/v1beta1/organization_service.proto +++ b/buf/registry/owner/v1beta1/organization_service.proto @@ -20,6 +20,8 @@ import "buf/registry/owner/v1beta1/organization.proto"; import "buf/registry/owner/v1beta1/user.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // Operate on Organizations service OrganizationService { // Get Organizations by id or name. diff --git a/buf/registry/owner/v1beta1/owner.proto b/buf/registry/owner/v1beta1/owner.proto index 00c44cf..f86fc13 100644 --- a/buf/registry/owner/v1beta1/owner.proto +++ b/buf/registry/owner/v1beta1/owner.proto @@ -21,6 +21,8 @@ import "buf/registry/owner/v1beta1/user.proto"; import "buf/registry/priv/extension/v1beta1/extension.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // A User or Organization. message Owner { option (buf.registry.priv.extension.v1beta1.message).response_only = true; diff --git a/buf/registry/owner/v1beta1/owner_service.proto b/buf/registry/owner/v1beta1/owner_service.proto index 8697fa7..ce0cabc 100644 --- a/buf/registry/owner/v1beta1/owner_service.proto +++ b/buf/registry/owner/v1beta1/owner_service.proto @@ -19,6 +19,8 @@ package buf.registry.owner.v1beta1; import "buf/registry/owner/v1beta1/owner.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // Operate on Users and Organizations in situations where you only // know a reference to an owner, without knowing whether or not that // owner is a User or Organization. diff --git a/buf/registry/owner/v1beta1/user.proto b/buf/registry/owner/v1beta1/user.proto index 366b31e..deb0f12 100644 --- a/buf/registry/owner/v1beta1/user.proto +++ b/buf/registry/owner/v1beta1/user.proto @@ -20,6 +20,8 @@ import "buf/registry/priv/extension/v1beta1/extension.proto"; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // A user on the BSR. // // A name uniquely identifies a User, however name is mutable. diff --git a/buf/registry/owner/v1beta1/user_service.proto b/buf/registry/owner/v1beta1/user_service.proto index 969f28f..03c335e 100644 --- a/buf/registry/owner/v1beta1/user_service.proto +++ b/buf/registry/owner/v1beta1/user_service.proto @@ -20,6 +20,8 @@ import "buf/registry/owner/v1beta1/organization.proto"; import "buf/registry/owner/v1beta1/user.proto"; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/owner/v1beta1"; + // Operate on Users. service UserService { // Get Users by id or name. diff --git a/buf/registry/priv/extension/v1beta1/extension.proto b/buf/registry/priv/extension/v1beta1/extension.proto index 5a4bfa3..855b8b7 100644 --- a/buf/registry/priv/extension/v1beta1/extension.proto +++ b/buf/registry/priv/extension/v1beta1/extension.proto @@ -18,6 +18,8 @@ package buf.registry.priv.extension.v1beta1; import "google/protobuf/descriptor.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/priv/extension/v1beta1"; + extend google.protobuf.MessageOptions { // Constraints on a message. MessageConstraints message = 1160; diff --git a/buf/registry/storage/v1beta1/storage.proto b/buf/registry/storage/v1beta1/storage.proto index a5dd322..10c5d5e 100644 --- a/buf/registry/storage/v1beta1/storage.proto +++ b/buf/registry/storage/v1beta1/storage.proto @@ -18,6 +18,8 @@ package buf.registry.storage.v1beta1; import "buf/validate/validate.proto"; +option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/storage/v1beta1"; + // A digest. message Digest { // The type of Digest.