Skip to content

Commit

Permalink
Use protoc 3.14.0 to generate protobuf v2 apis. (dapr#2700)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip

* fix linter

* regen

* update go mod in tests
  • Loading branch information
youngbupark authored Jan 22, 2021
1 parent e36d959 commit be08e55
Show file tree
Hide file tree
Showing 41 changed files with 2,640 additions and 1,500 deletions.
2 changes: 1 addition & 1 deletion dapr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Proto client generation

1. Install protoc version: [v3.11.0](https://github.com/protocolbuffers/protobuf/releases/tag/v3.11.0)
1. Install protoc version: [v3.14.0](https://github.com/protocolbuffers/protobuf/releases/tag/v3.14.0)

2. Install protoc-gen-go and protoc-gen-go-grpc

Expand Down
10 changes: 5 additions & 5 deletions pkg/channel/testing/grpc_channel_server_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

commonv1pb "github.com/dapr/dapr/pkg/proto/common/v1"
runtimev1pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
"github.com/golang/protobuf/ptypes/any"
"github.com/golang/protobuf/ptypes/empty"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/emptypb"
)

// MockServer implementation of fake user app server
Expand All @@ -40,16 +40,16 @@ func (m *MockServer) OnInvoke(ctx context.Context, in *commonv1pb.InvokeRequest)
dt["querystring"] = string(serialized)

ds, _ := json.Marshal(dt)
return &commonv1pb.InvokeResponse{Data: &any.Any{Value: ds}, ContentType: "application/json"}, m.Error
return &commonv1pb.InvokeResponse{Data: &anypb.Any{Value: ds}, ContentType: "application/json"}, m.Error
}

func (m *MockServer) ListTopicSubscriptions(ctx context.Context, in *empty.Empty) (*runtimev1pb.ListTopicSubscriptionsResponse, error) {
func (m *MockServer) ListTopicSubscriptions(ctx context.Context, in *emptypb.Empty) (*runtimev1pb.ListTopicSubscriptionsResponse, error) {
return &runtimev1pb.ListTopicSubscriptionsResponse{
Subscriptions: m.Subscriptions,
}, m.Error
}

func (m *MockServer) ListInputBindings(ctx context.Context, in *empty.Empty) (*runtimev1pb.ListInputBindingsResponse, error) {
func (m *MockServer) ListInputBindings(ctx context.Context, in *emptypb.Empty) (*runtimev1pb.ListInputBindingsResponse, error) {
return &runtimev1pb.ListInputBindingsResponse{
Bindings: m.Bindings,
}, m.Error
Expand Down
4 changes: 2 additions & 2 deletions pkg/components/kubernetes_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
config "github.com/dapr/dapr/pkg/config/modes"
"github.com/dapr/dapr/pkg/logger"
operatorv1pb "github.com/dapr/dapr/pkg/proto/operator/v1"
"github.com/golang/protobuf/ptypes/empty"
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
"google.golang.org/protobuf/types/known/emptypb"
)

var log = logger.NewLogger("dapr.runtime.components")
Expand All @@ -41,7 +41,7 @@ func NewKubernetesComponents(configuration config.KubernetesConfig, operatorClie

// LoadComponents returns components from a given control plane address
func (k *KubernetesComponents) LoadComponents() ([]components_v1alpha1.Component, error) {
resp, err := k.client.ListComponents(context.Background(), &empty.Empty{}, grpc_retry.WithMax(operatorMaxRetries), grpc_retry.WithPerRetryTimeout(operatorCallTimeout))
resp, err := k.client.ListComponents(context.Background(), &emptypb.Empty{}, grpc_retry.WithMax(operatorMaxRetries), grpc_retry.WithPerRetryTimeout(operatorCallTimeout))
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/components/kubernetes_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
subscriptions "github.com/dapr/dapr/pkg/apis/subscriptions/v1alpha1"
config "github.com/dapr/dapr/pkg/config/modes"
operatorv1pb "github.com/dapr/dapr/pkg/proto/operator/v1"
"github.com/golang/protobuf/ptypes/empty"
"github.com/phayes/freeport"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)

type mockOperator struct {
Expand All @@ -25,7 +25,7 @@ func (o *mockOperator) GetConfiguration(ctx context.Context, in *operatorv1pb.Ge
return nil, nil
}

func (o *mockOperator) ListComponents(ctx context.Context, in *empty.Empty) (*operatorv1pb.ListComponentResponse, error) {
func (o *mockOperator) ListComponents(ctx context.Context, in *emptypb.Empty) (*operatorv1pb.ListComponentResponse, error) {
component := v1alpha1.Component{}
component.ObjectMeta.Name = "test"
component.Spec = v1alpha1.ComponentSpec{
Expand All @@ -38,7 +38,7 @@ func (o *mockOperator) ListComponents(ctx context.Context, in *empty.Empty) (*op
}, nil
}

func (o *mockOperator) ListSubscriptions(ctx context.Context, in *empty.Empty) (*operatorv1pb.ListSubscriptionsResponse, error) {
func (o *mockOperator) ListSubscriptions(ctx context.Context, in *emptypb.Empty) (*operatorv1pb.ListSubscriptionsResponse, error) {
subscription := subscriptions.Subscription{}
subscription.ObjectMeta.Name = "test"
subscription.Spec = subscriptions.SubscriptionSpec{
Expand All @@ -53,7 +53,7 @@ func (o *mockOperator) ListSubscriptions(ctx context.Context, in *empty.Empty) (
}, nil
}

func (o *mockOperator) ComponentUpdate(in *empty.Empty, srv operatorv1pb.Operator_ComponentUpdateServer) error {
func (o *mockOperator) ComponentUpdate(in *emptypb.Empty, srv operatorv1pb.Operator_ComponentUpdateServer) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/diagnostics/grpc_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"time"

diag_utils "github.com/dapr/dapr/pkg/diagnostics/utils"
"github.com/golang/protobuf/proto"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
"google.golang.org/grpc"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)

// This implementation is inspired by
Expand Down
Loading

0 comments on commit be08e55

Please sign in to comment.