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

Update buf.build/go/bufplugin to v0.3.0 #95

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions cmd/buf-plugin-aep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"buf.build/go/bufplugin/check"
"buf.build/go/bufplugin/descriptor"
"github.com/aep-dev/api-linter/lint"
"github.com/aep-dev/api-linter/rules"
"github.com/jhump/protoreflect/desc"
Expand Down Expand Up @@ -152,24 +153,24 @@ func addProblem(responseWriter check.ResponseWriter, problem lint.Problem) error
}

func before(ctx context.Context, request check.Request) (context.Context, check.Request, error) {
fileDescriptors, err := nonImportFileDescriptorsForFiles(request.Files())
fileDescriptors, err := nonImportFileDescriptorsForFileDescriptors(request.FileDescriptors())
if err != nil {
return nil, nil, err
}
ctx = context.WithValue(ctx, fileDescriptorsContextKey{}, fileDescriptors)
return ctx, request, nil
}

func nonImportFileDescriptorsForFiles(files []check.File) ([]*desc.FileDescriptor, error) {
if len(files) == 0 {
func nonImportFileDescriptorsForFileDescriptors(fileDescriptors []descriptor.FileDescriptor) ([]*desc.FileDescriptor, error) {
if len(fileDescriptors) == 0 {
return nil, nil
}
reflectFileDescriptors := make([]protoreflect.FileDescriptor, 0, len(files))
for _, file := range files {
if file.IsImport() {
reflectFileDescriptors := make([]protoreflect.FileDescriptor, 0, len(fileDescriptors))
for _, fileDescriptor := range fileDescriptors {
if fileDescriptor.IsImport() {
continue
}
reflectFileDescriptors = append(reflectFileDescriptors, file.FileDescriptor())
reflectFileDescriptors = append(reflectFileDescriptors, fileDescriptor.ProtoreflectFileDescriptor())
}
return desc.WrapFiles(reflectFileDescriptors)
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.1
require (
bitbucket.org/creachadair/stringset v0.0.14
buf.build/gen/go/aep/api/protocolbuffers/go v1.34.2-20240717204542-6b47820e6610.2
buf.build/go/bufplugin v0.2.0
buf.build/go/bufplugin v0.3.0
cloud.google.com/go/longrunning v0.6.1
github.com/bmatcuk/doublestar/v4 v4.6.1
github.com/gertd/go-pluralize v0.2.1
Expand All @@ -24,7 +24,7 @@ require (
)

require (
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240904181154-a0be11449112.2 // indirect
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240920185553-cf97df2825f6.2 // indirect
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2 // indirect
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ buf.build/gen/go/aep/api/protocolbuffers/go v1.34.2-20240717204542-6b47820e6610.
buf.build/gen/go/aep/api/protocolbuffers/go v1.34.2-20240717204542-6b47820e6610.2/go.mod h1:7GnupzUM4BaoyPcUUTZZwrcVZvCBNcyn6iR/kddRTuU=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240904181154-a0be11449112.2 h1:X9qBPcvWGOJs/CeRVLoxxLJwC/eKyWDS/G4nj+3KGMY=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240904181154-a0be11449112.2/go.mod h1:B+9TKHRYqoAUW57pLjhkLOnBCu0DQYMV+f7imQ9nXwI=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240920185553-cf97df2825f6.2 h1:dM/jKJP5298DVmmet50pEaREQY1ZleguYDrpUWwl6AA=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.34.2-20240920185553-cf97df2825f6.2/go.mod h1:B+9TKHRYqoAUW57pLjhkLOnBCu0DQYMV+f7imQ9nXwI=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2 h1:SZRVx928rbYZ6hEKUIN+vtGDkl7uotABRWGY4OAg5gM=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2/go.mod h1:ylS4c28ACSI59oJrOdW4pHS4n0Hw4TgSPHn8rpHl4Yw=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2 h1:oSi+Adw4xvIjXrW8eY8QGR3sBdfWeY5HN/RefnRt52M=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.34.2-20240828222655-5345c0a56177.2/go.mod h1:GjH0gjlY/ns16X8d6eaXV2W+6IFwsO5Ly9WVnzyd1E0=
buf.build/go/bufplugin v0.2.0 h1:nnNvWzUgQXitRDmjWWIkuXj9klreAAE94sVCsL+0v5g=
buf.build/go/bufplugin v0.2.0/go.mod h1:ZZYGt6PDcjbBSywdz/G8NdXkIuWi2rzR8CduGzbCPdk=
buf.build/go/bufplugin v0.3.0 h1:0kxad9/q3nCEbHVYR02crapmRyVT0zTqC/gNkzxuWSs=
buf.build/go/bufplugin v0.3.0/go.mod h1:Znx3zF4ThDWGN1eGFMsbVT9LkMcVV4MKeAC9hiGdN6g=
cloud.google.com/go/longrunning v0.6.1 h1:lOLTFxYpr8hcRtcwWir5ITh1PAKUD/sG2lKrTSYjyMc=
cloud.google.com/go/longrunning v0.6.1/go.mod h1:nHISoOZpBcmlwbJmiVk5oDRz0qG/ZxPynEGs1iZ79s0=
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
Expand Down