Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed May 8, 2023
1 parent e08b7ac commit f235aae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion server/grpc/gogoreflection/serverreflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
rpb "google.golang.org/grpc/reflection/grpc_reflection_v1"
"google.golang.org/grpc/status"
)

Expand Down
32 changes: 16 additions & 16 deletions tools/hubl/internal/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1beta1 "cosmossdk.io/api/cosmos/base/reflection/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"google.golang.org/grpc/reflection/grpc_reflection_v1"
"google.golang.org/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
Expand All @@ -35,13 +35,13 @@ func loadFileDescriptorsGRPCReflection(ctx context.Context, client *grpc.ClientC
}
}

reflectClient, err := grpc_reflection_v1alpha.NewServerReflectionClient(client).ServerReflectionInfo(ctx)
reflectClient, err := grpc_reflection_v1.NewServerReflectionClient(client).ServerReflectionInfo(ctx)
if err != nil {
return nil, err
}

fdMap := map[string]*descriptorpb.FileDescriptorProto{}
waitListServiceRes := make(chan *grpc_reflection_v1alpha.ListServiceResponse)
waitListServiceRes := make(chan *grpc_reflection_v1.ListServiceResponse)
waitc := make(chan struct{})
go func() {
for {
Expand All @@ -56,25 +56,25 @@ func loadFileDescriptorsGRPCReflection(ctx context.Context, client *grpc.ClientC
}

switch res := in.MessageResponse.(type) {
case *grpc_reflection_v1alpha.ServerReflectionResponse_ListServicesResponse:
case *grpc_reflection_v1.ServerReflectionResponse_ListServicesResponse:
waitListServiceRes <- res.ListServicesResponse
case *grpc_reflection_v1alpha.ServerReflectionResponse_FileDescriptorResponse:
case *grpc_reflection_v1.ServerReflectionResponse_FileDescriptorResponse:
processFileDescriptorsResponse(res, fdMap)
}
}
}()

if err = reflectClient.Send(&grpc_reflection_v1alpha.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1alpha.ServerReflectionRequest_ListServices{},
if err = reflectClient.Send(&grpc_reflection_v1.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1.ServerReflectionRequest_ListServices{},
}); err != nil {
return nil, err
}

listServiceRes := <-waitListServiceRes

for _, response := range listServiceRes.Service {
err = reflectClient.Send(&grpc_reflection_v1alpha.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1alpha.ServerReflectionRequest_FileContainingSymbol{
err = reflectClient.Send(&grpc_reflection_v1.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1.ServerReflectionRequest_FileContainingSymbol{
FileContainingSymbol: response.Name,
},
})
Expand All @@ -84,8 +84,8 @@ func loadFileDescriptorsGRPCReflection(ctx context.Context, client *grpc.ClientC
}

for _, msgName := range interfaceImplNames {
err = reflectClient.Send(&grpc_reflection_v1alpha.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1alpha.ServerReflectionRequest_FileContainingSymbol{
err = reflectClient.Send(&grpc_reflection_v1.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1.ServerReflectionRequest_FileContainingSymbol{
FileContainingSymbol: msgName,
},
})
Expand Down Expand Up @@ -133,7 +133,7 @@ func loadFileDescriptorsGRPCReflection(ctx context.Context, client *grpc.ClientC
return fdSet, nil
}

func processFileDescriptorsResponse(res *grpc_reflection_v1alpha.ServerReflectionResponse_FileDescriptorResponse, fdMap map[string]*descriptorpb.FileDescriptorProto) {
func processFileDescriptorsResponse(res *grpc_reflection_v1.ServerReflectionResponse_FileDescriptorResponse, fdMap map[string]*descriptorpb.FileDescriptorProto) {
for _, bz := range res.FileDescriptorResponse.FileDescriptorProto {
fd := &descriptorpb.FileDescriptorProto{}
err := proto.Unmarshal(bz, fd)
Expand All @@ -158,7 +158,7 @@ func missingFileDescriptors(fdMap map[string]*descriptorpb.FileDescriptorProto,
}

func addMissingFileDescriptors(ctx context.Context, client *grpc.ClientConn, fdMap map[string]*descriptorpb.FileDescriptorProto, missingFiles []string) error {
reflectClient, err := grpc_reflection_v1alpha.NewServerReflectionClient(client).ServerReflectionInfo(ctx)
reflectClient, err := grpc_reflection_v1.NewServerReflectionClient(client).ServerReflectionInfo(ctx)
if err != nil {
return err
}
Expand All @@ -176,15 +176,15 @@ func addMissingFileDescriptors(ctx context.Context, client *grpc.ClientConn, fdM
panic(err)
}

if res, ok := in.MessageResponse.(*grpc_reflection_v1alpha.ServerReflectionResponse_FileDescriptorResponse); ok {
if res, ok := in.MessageResponse.(*grpc_reflection_v1.ServerReflectionResponse_FileDescriptorResponse); ok {
processFileDescriptorsResponse(res, fdMap)
}
}
}()

for _, file := range missingFiles {
err = reflectClient.Send(&grpc_reflection_v1alpha.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1alpha.ServerReflectionRequest_FileByFilename{
err = reflectClient.Send(&grpc_reflection_v1.ServerReflectionRequest{
MessageRequest: &grpc_reflection_v1.ServerReflectionRequest_FileByFilename{
FileByFilename: file,
},
})
Expand Down

0 comments on commit f235aae

Please sign in to comment.