Skip to content

Commit

Permalink
Upgrade to protobuf-go v1.36.1 (#3563)
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev authored Dec 27, 2024
1 parent 19dc32a commit 7cc13d3
Show file tree
Hide file tree
Showing 127 changed files with 84,540 additions and 4,285 deletions.
3 changes: 2 additions & 1 deletion data/template/buf.go.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ plugins:
out: private/gen/proto/go
opt:
- paths=source_relative
- default_api_level=API_HYBRID
- Mgoogle/protobuf/cpp_features.proto=github.com/bufbuild/buf/private/gen/proto/go/google/protobuf
- Mgoogle/protobuf/java_features.proto=github.com/bufbuild/buf/private/gen/proto/go/google/protobuf
inputs:
- directory: proto
- module: buf.build/grpc/grpc
types:
- grpc.reflection.v1.ServerReflection
- module: buf.build/protocolbuffers/wellknowntypes:v27.0
- module: buf.build/protocolbuffers/wellknowntypes:v29.1
paths:
- google/protobuf/cpp_features.proto
- google/protobuf/java_features.proto
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.22.0
toolchain go1.23.4

require (
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.0-20241031151143-70f632351282.1
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.0-20241127180247-a33202765966.1
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.1-20241031151143-70f632351282.1
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.1-20241127180247-a33202765966.1
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.17.0-20241210175624-28487aef65cd.1
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.0-20241210175624-28487aef65cd.1
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.1-20241210175624-28487aef65cd.1
buf.build/go/bufplugin v0.6.0
buf.build/go/protoyaml v0.3.1
buf.build/go/spdx v0.2.0
Expand Down Expand Up @@ -47,13 +47,13 @@ require (
golang.org/x/sync v0.10.0
golang.org/x/term v0.27.0
golang.org/x/tools v0.28.0
google.golang.org/protobuf v1.36.0
google.golang.org/protobuf v1.36.1
gopkg.in/yaml.v3 v3.0.1
pluginrpc.com/pluginrpc v0.5.0
)

require (
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.0-20241007202033-cf42259fcbfc.1 // indirect
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.1-20241007202033-cf42259fcbfc.1 // indirect
cel.dev/expr v0.19.1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
Expand Down Expand Up @@ -123,7 +123,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/grpc v1.69.2 // indirect
)
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.0-20241031151143-70f632351282.1 h1:FXEFgDFrBYuXjn3twNRo/t80qSbdKmkfZSgR2JGTuyk=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.0-20241031151143-70f632351282.1/go.mod h1:/bPD5uslGsdRKBeVavIK7D7yr+3ISI0OoyUOkokSJTA=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.0-20241127180247-a33202765966.1 h1:ntAj16eF7AtUyzOOAFk5gvbAO52QmUKPKk7GmsIEORo=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.0-20241127180247-a33202765966.1/go.mod h1:AxRT+qTj5PJCz2nyQzsR/qxAcveW5USRhJTt/edTO5w=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.1-20241031151143-70f632351282.1 h1:DELauram5j4snPU5wB0/I7EIQiy7oRjngqbitbj4o6c=
buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.1-20241031151143-70f632351282.1/go.mod h1:VfQZo/3dl9O9Yg1nseI0gNGDXvLrNQfBRMMIhV9fyII=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.1-20241127180247-a33202765966.1 h1:v223wh/bhlSHSc0tU9PXRWXHhkw3UWMtth7TmYGfHAQ=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.1-20241127180247-a33202765966.1/go.mod h1:/zlFuuECgFgewxwW6qQKgvMJ07YZkWlVkcSxEhJprJw=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.17.0-20241210175624-28487aef65cd.1 h1:x8cCitPNXODGzWbfApZMFc4ALtRe5LZJmTdAkNqk62A=
buf.build/gen/go/bufbuild/registry/connectrpc/go v1.17.0-20241210175624-28487aef65cd.1/go.mod h1:kDOQd1sZ0wRp33hvCTQeaz9KprnHNfJ+a8dcIQ/6+0k=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.0-20241210175624-28487aef65cd.1 h1:NOuNS+nCp3xc4CALIC7sNz7irT63UMcYAfofrxurUfE=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.0-20241210175624-28487aef65cd.1/go.mod h1:NeX3YCZgM9E/wNp9e3g/9u5bu8/OPntr7K0ygUlgrDE=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.0-20241007202033-cf42259fcbfc.1 h1:HuK77NuzllXrJNgB+lAtnG2dKrB7WAjd9QQ+n0zTQHc=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.0-20241007202033-cf42259fcbfc.1/go.mod h1:BLQCnWbu3tZcKQfbU1f5ysbRk55FDFwOvjlyzN+uLXg=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.1-20241210175624-28487aef65cd.1 h1:VU8k1n06qmuNXtI/LekXyjxAtG0NQdZtbmLSkBUjIm4=
buf.build/gen/go/bufbuild/registry/protocolbuffers/go v1.36.1-20241210175624-28487aef65cd.1/go.mod h1:DgqZjUk2avpwh8jiMHBOoVXUyceQ3HxNwcRLEWWwNtQ=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.1-20241007202033-cf42259fcbfc.1 h1:0Pi0EQh6z2zJigi4UonoqczBQjvOzZ0CFYUfwPRM41M=
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.1-20241007202033-cf42259fcbfc.1/go.mod h1:Uy8SKofLXIAUjswDmz6AIN8W+bGVTF4kNczZikMPHLM=
buf.build/go/bufplugin v0.6.0 h1:3lhoh+0z+IUPS3ZajTPn/27LaLIkero2BDVnV7yXD1s=
buf.build/go/bufplugin v0.6.0/go.mod h1:hWCjxxv24xdR6F5pNlQavZV2oo0J3uF4Ff1XEoyV6vU=
buf.build/go/protoyaml v0.3.1 h1:ucyzE7DRnjX+mQ6AH4JzN0Kg50ByHHu+yrSKbgQn2D4=
Expand Down Expand Up @@ -377,10 +377,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb h1:B7GIB7sr443wZ/EAEl7VZjmh1V6qzkt5V+RYcUYtS1U=
google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:E5//3O5ZIG2l71Xnt+P/CYUY8Bxs8E7WMoZ9tlcMbAY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb h1:3oy2tynMOP1QbTC0MsNNAV+Se8M2Bd0A5+x1QHyw+pI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241219192143-6b3ec007d9bb/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 h1:st3LcW/BPi75W4q1jJTEor/QWwbNlPlDG0JTn6XhZu0=
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:klhJGKFyG8Tn50enBn7gizg4nXGXJ+jqEREdCWaPcV4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
Expand All @@ -397,8 +397,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
2 changes: 1 addition & 1 deletion make/buf/all.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ LICENSE_HEADER_YEAR_RANGE := 2020-2024
LICENSE_HEADER_IGNORES := \/testdata enterprise
PROTOVALIDATE_VERSION := v0.8.1
# Comment out to use released buf
BUF_GO_INSTALL_PATH := ./cmd/buf
#BUF_GO_INSTALL_PATH := ./cmd/buf

BUF_LINT_INPUT := .
BUF_BREAKING_INPUT := .
Expand Down
4 changes: 2 additions & 2 deletions make/go/dep_buf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ $(call _assert_var,CACHE_VERSIONS)
$(call _assert_var,CACHE_BIN)

# Settable
# https://github.com/bufbuild/buf/releases 20241114 checked 20241114
BUF_VERSION ?= v1.47.2
# https://github.com/bufbuild/buf/releases 20241219 checked 20241219
BUF_VERSION ?= v1.48.0
# Settable
#
# If set, this path will be installed every time someone depends on $(BUF)
Expand Down
4 changes: 2 additions & 2 deletions make/go/dep_protoc_gen_go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ $(call _assert_var,CACHE_VERSIONS)
$(call _assert_var,CACHE_BIN)

# Settable
# https://github.com/protocolbuffers/protobuf-go/releases 20241216 checked 20241217
PROTOC_GEN_GO_VERSION ?= v1.36.0
# https://github.com/protocolbuffers/protobuf-go/releases 20241223 checked 20241227
PROTOC_GEN_GO_VERSION ?= v1.36.1

GO_GET_PKGS := $(GO_GET_PKGS) \
google.golang.org/protobuf/proto@$(PROTOC_GEN_GO_VERSION)
Expand Down
6 changes: 3 additions & 3 deletions private/buf/bufctl/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ func (c *controller) getImageForMessageRef(
}

if functionOptions.imageExcludeSourceInfo {
for _, fileDescriptorProto := range protoImage.File {
fileDescriptorProto.SourceCodeInfo = nil
for _, fileDescriptorProto := range protoImage.GetFile() {
fileDescriptorProto.ClearSourceCodeInfo()
}
}

Expand Down Expand Up @@ -1315,7 +1315,7 @@ func bootstrapResolver(
if err := unmarshaler.Unmarshal(data, firstProtoImage); err != nil {
return nil, err
}
return protoencoding.NewResolver(firstProtoImage.File...)
return protoencoding.NewResolver(firstProtoImage.GetFile()...)
}

// WE DO NOT FILTER IF WE ALREADY FILTERED ON BUILDING OF A WORKSPACE
Expand Down
77 changes: 35 additions & 42 deletions private/buf/bufcurl/reflection_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
reflectionv1 "github.com/bufbuild/buf/private/gen/proto/go/grpc/reflection/v1"
"github.com/bufbuild/buf/private/pkg/protoencoding"
"github.com/bufbuild/buf/private/pkg/verbose"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
Expand Down Expand Up @@ -154,30 +155,28 @@ func (r *reflectionResolver) ListServices() ([]protoreflect.FullName, error) {
defer r.mu.Unlock()

r.printer.Printf("* Using server reflection to list services\n")
resp, err := r.sendLocked(&reflectionv1.ServerReflectionRequest{
MessageRequest: &reflectionv1.ServerReflectionRequest_ListServices{
ListServices: "",
},
})
resp, err := r.sendLocked(reflectionv1.ServerReflectionRequest_builder{
ListServices: proto.String(""),
}.Build())
if err != nil {
return nil, err
}
switch response := resp.MessageResponse.(type) {
case *reflectionv1.ServerReflectionResponse_ErrorResponse:
switch resp.WhichMessageResponse() {
case reflectionv1.ServerReflectionResponse_ErrorResponse_case:
// This should never happen, however we do a bounds check to ensure we are doing a safe
// conversion from int32 (ErrorResponse.ErrorCode) to uint32 (connect.Code).
if response.ErrorResponse.ErrorCode < 0 {
return nil, fmt.Errorf("server replied with unsupported error code: %v", response.ErrorResponse.ErrorCode)
if resp.GetErrorResponse().GetErrorCode() < 0 {
return nil, fmt.Errorf("server replied with unsupported error code: %v", resp.GetErrorResponse().GetErrorCode())
}
return nil, connect.NewWireError(connect.Code(response.ErrorResponse.ErrorCode), errors.New(response.ErrorResponse.ErrorMessage))
case *reflectionv1.ServerReflectionResponse_ListServicesResponse:
serviceNames := make([]protoreflect.FullName, len(response.ListServicesResponse.Service))
for i, service := range response.ListServicesResponse.Service {
serviceNames[i] = protoreflect.FullName(service.Name)
return nil, connect.NewWireError(connect.Code(resp.GetErrorResponse().GetErrorCode()), errors.New(resp.GetErrorResponse().GetErrorMessage()))
case reflectionv1.ServerReflectionResponse_ListServicesResponse_case:
serviceNames := make([]protoreflect.FullName, len(resp.GetListServicesResponse().GetService()))
for i, service := range resp.GetListServicesResponse().GetService() {
serviceNames[i] = protoreflect.FullName(service.GetName())
}
return serviceNames, nil
default:
return nil, fmt.Errorf("server replied with unsupported response type: %T", resp.MessageResponse)
return nil, fmt.Errorf("server replied with unsupported response type: %v", resp.WhichMessageResponse())
}
}

Expand Down Expand Up @@ -300,11 +299,9 @@ func (r *reflectionResolver) FindExtensionByNumber(message protoreflect.FullName

func (r *reflectionResolver) fileContainingSymbolLocked(name protoreflect.FullName) ([]*descriptorpb.FileDescriptorProto, error) {
r.printer.Printf("* Using server reflection to resolve %q\n", name)
resp, err := r.sendLocked(&reflectionv1.ServerReflectionRequest{
MessageRequest: &reflectionv1.ServerReflectionRequest_FileContainingSymbol{
FileContainingSymbol: string(name),
},
})
resp, err := r.sendLocked(reflectionv1.ServerReflectionRequest_builder{
FileContainingSymbol: proto.String(string(name)),
}.Build())
if err != nil {
return nil, err
}
Expand All @@ -313,14 +310,12 @@ func (r *reflectionResolver) fileContainingSymbolLocked(name protoreflect.FullNa

func (r *reflectionResolver) fileContainingExtensionLocked(message protoreflect.FullName, field protoreflect.FieldNumber) ([]*descriptorpb.FileDescriptorProto, error) {
r.printer.Printf("* Using server reflection to retrieve extension %d for %q\n", field, message)
resp, err := r.sendLocked(&reflectionv1.ServerReflectionRequest{
MessageRequest: &reflectionv1.ServerReflectionRequest_FileContainingExtension{
FileContainingExtension: &reflectionv1.ExtensionRequest{
ContainingType: string(message),
ExtensionNumber: int32(field),
},
},
})
resp, err := r.sendLocked(reflectionv1.ServerReflectionRequest_builder{
FileContainingExtension: reflectionv1.ExtensionRequest_builder{
ContainingType: string(message),
ExtensionNumber: int32(field),
}.Build(),
}.Build())
if err != nil {
return nil, err
}
Expand All @@ -329,29 +324,27 @@ func (r *reflectionResolver) fileContainingExtensionLocked(message protoreflect.

func (r *reflectionResolver) fileByNameLocked(name string) ([]*descriptorpb.FileDescriptorProto, error) {
r.printer.Printf("* Using server reflection to download file %q\n", name)
resp, err := r.sendLocked(&reflectionv1.ServerReflectionRequest{
MessageRequest: &reflectionv1.ServerReflectionRequest_FileByFilename{
FileByFilename: name,
},
})
resp, err := r.sendLocked(reflectionv1.ServerReflectionRequest_builder{
FileByFilename: proto.String(name),
}.Build())
if err != nil {
return nil, err
}
return descriptorsInResponse(resp)
}

func descriptorsInResponse(resp *reflectionv1.ServerReflectionResponse) ([]*descriptorpb.FileDescriptorProto, error) {
switch response := resp.MessageResponse.(type) {
case *reflectionv1.ServerReflectionResponse_ErrorResponse:
switch resp.WhichMessageResponse() {
case reflectionv1.ServerReflectionResponse_ErrorResponse_case:
// This should never happen, however we do a bounds check to ensure we are doing a safe
// conversion from int32 (ErrorResponse.ErrorCode) to uint32 (connect.Code).
if response.ErrorResponse.ErrorCode < 0 {
return nil, fmt.Errorf("server replied with unsupported error code: %v", response.ErrorResponse.ErrorCode)
if resp.GetErrorResponse().GetErrorCode() < 0 {
return nil, fmt.Errorf("server replied with unsupported error code: %v", resp.GetErrorResponse().GetErrorCode())
}
return nil, connect.NewWireError(connect.Code(response.ErrorResponse.ErrorCode), errors.New(response.ErrorResponse.ErrorMessage))
case *reflectionv1.ServerReflectionResponse_FileDescriptorResponse:
files := make([]*descriptorpb.FileDescriptorProto, len(response.FileDescriptorResponse.FileDescriptorProto))
for i, data := range response.FileDescriptorResponse.FileDescriptorProto {
return nil, connect.NewWireError(connect.Code(resp.GetErrorResponse().GetErrorCode()), errors.New(resp.GetErrorResponse().GetErrorMessage()))
case reflectionv1.ServerReflectionResponse_FileDescriptorResponse_case:
files := make([]*descriptorpb.FileDescriptorProto, len(resp.GetFileDescriptorResponse().GetFileDescriptorProto()))
for i, data := range resp.GetFileDescriptorResponse().GetFileDescriptorProto() {
var file descriptorpb.FileDescriptorProto
if err := protoencoding.NewWireUnmarshaler(nil).Unmarshal(data, &file); err != nil {
return nil, err
Expand All @@ -360,7 +353,7 @@ func descriptorsInResponse(resp *reflectionv1.ServerReflectionResponse) ([]*desc
}
return files, nil
default:
return nil, fmt.Errorf("server replied with unsupported response type: %T", resp.MessageResponse)
return nil, fmt.Errorf("server replied with unsupported response type: %v", resp.WhichMessageResponse())
}
}

Expand Down
10 changes: 5 additions & 5 deletions private/buf/bufgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,16 @@ func (g *generator) execRemotePluginsV2(
response, err := codeGenerationService.GenerateCode(
ctx,
connect.NewRequest(
&registryv1alpha1.GenerateCodeRequest{
registryv1alpha1.GenerateCodeRequest_builder{
Image: protoImage,
Requests: requests,
},
}.Build(),
),
)
if err != nil {
return nil, err
}
responses := response.Msg.Responses
responses := response.Msg.GetResponses()
if len(responses) != len(requests) {
return nil, fmt.Errorf("unexpected number of responses received, got %d, wanted %d", len(responses), len(requests))
}
Expand Down Expand Up @@ -433,12 +433,12 @@ func getPluginGenerationRequest(
// Only include parameters if they're not empty.
options = []string{pluginConfig.Opt()}
}
return &registryv1alpha1.PluginGenerationRequest{
return registryv1alpha1.PluginGenerationRequest_builder{
PluginReference: curatedPluginReference,
Options: options,
IncludeImports: &includeImports,
IncludeWellKnownTypes: &includeWellKnownTypes,
}, nil
}.Build(), nil
}

// validateResponses verifies that a response is set for each of the
Expand Down
4 changes: 2 additions & 2 deletions private/buf/bufprint/bufprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ func NewPluginEntity(plugin *pluginv1beta1.Plugin, pluginFullName bufparse.FullN
// NewUserEntity returns a new user entity to print.
func NewUserEntity(user *registryv1alpha1.User) Entity {
return outputUser{
Username: user.Username,
Username: user.GetUsername(),
// We use the Username as the full name for the user when printing.
FullName: user.Username,
FullName: user.GetUsername(),
}
}

Expand Down
18 changes: 9 additions & 9 deletions private/buf/bufprint/curated_plugin_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func (p *curatedPluginPrinter) printCuratedPluginsText(plugins ...*registryv1alp
func(tabWriter TabWriter) error {
for _, plugin := range plugins {
if err := tabWriter.Write(
plugin.Owner,
plugin.Name,
plugin.Version,
strconv.FormatInt(int64(plugin.Revision), 10),
plugin.GetOwner(),
plugin.GetName(),
plugin.GetVersion(),
strconv.FormatInt(int64(plugin.GetRevision()), 10),
); err != nil {
return err
}
Expand All @@ -103,10 +103,10 @@ type outputCuratedPlugin struct {

func registryCuratedPluginToOutputCuratedPlugin(plugin *registryv1alpha1.CuratedPlugin) outputCuratedPlugin {
return outputCuratedPlugin{
Owner: plugin.Owner,
Name: plugin.Name,
Version: plugin.Version,
Revision: plugin.Revision,
ImageDigest: plugin.ContainerImageDigest,
Owner: plugin.GetOwner(),
Name: plugin.GetName(),
Version: plugin.GetVersion(),
Revision: plugin.GetRevision(),
ImageDigest: plugin.GetContainerImageDigest(),
}
}
Loading

0 comments on commit 7cc13d3

Please sign in to comment.