Update protobuf to new API (#401)
This should have no functionality change, as they
should be backed by the same implementations, as per
https://go.dev/blog/protobuf-apiv2
diff --git a/go.mod b/go.mod
index cbc0a06..8efb8c8 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,6 @@
cloud.google.com/go v0.65.0 // indirect
github.com/bazelbuild/remote-apis v0.0.0-20210718193713-0ecef08215cf
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
- github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.5
github.com/klauspost/compress v1.12.3
github.com/mostynb/zstdpool-syncpool v0.0.7
@@ -18,5 +17,5 @@
google.golang.org/api v0.30.0
google.golang.org/genproto v0.0.0-20210506142907-4a47615972c2
google.golang.org/grpc v1.37.0
- google.golang.org/protobuf v1.26.0
+ google.golang.org/protobuf v1.27.1
)
diff --git a/go.sum b/go.sum
index c78eb6d..7a6af8e 100644
--- a/go.sum
+++ b/go.sum
@@ -398,8 +398,9 @@
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
-google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
+google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
diff --git a/go/pkg/balancer/BUILD.bazel b/go/pkg/balancer/BUILD.bazel
index 0cba500..0797b5a 100644
--- a/go/pkg/balancer/BUILD.bazel
+++ b/go/pkg/balancer/BUILD.bazel
@@ -11,7 +11,7 @@
visibility = ["//visibility:public"],
deps = [
"//go/pkg/balancer/proto",
- "@com_github_golang_protobuf//jsonpb:go_default_library_gen",
+ "@org_golang_google_protobuf//encoding/protojson",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//balancer:go_default_library",
"@org_golang_google_grpc//connectivity:go_default_library",
diff --git a/go/pkg/balancer/gcp_interceptor.go b/go/pkg/balancer/gcp_interceptor.go
index fbe119b..d80ada3 100644
--- a/go/pkg/balancer/gcp_interceptor.go
+++ b/go/pkg/balancer/gcp_interceptor.go
@@ -2,12 +2,12 @@
import (
"context"
- "os"
+ "io/ioutil"
"sync"
pb "github.com/bazelbuild/remote-apis-sdks/go/pkg/balancer/proto"
- "github.com/golang/protobuf/jsonpb"
"google.golang.org/grpc"
+ "google.golang.org/protobuf/encoding/protojson"
)
const (
@@ -196,11 +196,11 @@
// ParseAPIConfig parses a json config file into ApiConfig proto message.
func ParseAPIConfig(path string) (*pb.ApiConfig, error) {
- jsonFile, err := os.Open(path)
+ jsonFile, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
result := &pb.ApiConfig{}
- jsonpb.Unmarshal(jsonFile, result)
+ protojson.Unmarshal(jsonFile, result)
return result, nil
}
diff --git a/go/pkg/balancer/proto/grpcbalancer.pb.go b/go/pkg/balancer/proto/grpcbalancer.pb.go
index e5058a5..5ee5eec 100755
--- a/go/pkg/balancer/proto/grpcbalancer.pb.go
+++ b/go/pkg/balancer/proto/grpcbalancer.pb.go
@@ -1,24 +1,24 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.17.0
// source: go/pkg/balancer/proto/grpcbalancer.proto
-package grpcbalancer
+package proto
import (
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- math "math"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
)
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
type AffinityConfig_Command int32
@@ -28,259 +28,424 @@
AffinityConfig_UNBIND AffinityConfig_Command = 2
)
-var AffinityConfig_Command_name = map[int32]string{
- 0: "BOUND",
- 1: "BIND",
- 2: "UNBIND",
-}
+// Enum value maps for AffinityConfig_Command.
+var (
+ AffinityConfig_Command_name = map[int32]string{
+ 0: "BOUND",
+ 1: "BIND",
+ 2: "UNBIND",
+ }
+ AffinityConfig_Command_value = map[string]int32{
+ "BOUND": 0,
+ "BIND": 1,
+ "UNBIND": 2,
+ }
+)
-var AffinityConfig_Command_value = map[string]int32{
- "BOUND": 0,
- "BIND": 1,
- "UNBIND": 2,
+func (x AffinityConfig_Command) Enum() *AffinityConfig_Command {
+ p := new(AffinityConfig_Command)
+ *p = x
+ return p
}
func (x AffinityConfig_Command) String() string {
- return proto.EnumName(AffinityConfig_Command_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
+func (AffinityConfig_Command) Descriptor() protoreflect.EnumDescriptor {
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_enumTypes[0].Descriptor()
+}
+
+func (AffinityConfig_Command) Type() protoreflect.EnumType {
+ return &file_go_pkg_balancer_proto_grpcbalancer_proto_enumTypes[0]
+}
+
+func (x AffinityConfig_Command) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use AffinityConfig_Command.Descriptor instead.
func (AffinityConfig_Command) EnumDescriptor() ([]byte, []int) {
- return fileDescriptor_aebddaecf1fa8cdb, []int{3, 0}
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP(), []int{3, 0}
}
type ApiConfig struct {
- ChannelPool *ChannelPoolConfig `protobuf:"bytes,2,opt,name=channel_pool,json=channelPool,proto3" json:"channel_pool,omitempty"`
- Method []*MethodConfig `protobuf:"bytes,1001,rep,name=method,proto3" json:"method,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChannelPool *ChannelPoolConfig `protobuf:"bytes,2,opt,name=channel_pool,json=channelPool,proto3" json:"channel_pool,omitempty"`
+ Method []*MethodConfig `protobuf:"bytes,1001,rep,name=method,proto3" json:"method,omitempty"`
}
-func (m *ApiConfig) Reset() { *m = ApiConfig{} }
-func (m *ApiConfig) String() string { return proto.CompactTextString(m) }
-func (*ApiConfig) ProtoMessage() {}
+func (x *ApiConfig) Reset() {
+ *x = ApiConfig{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ApiConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ApiConfig) ProtoMessage() {}
+
+func (x *ApiConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ApiConfig.ProtoReflect.Descriptor instead.
func (*ApiConfig) Descriptor() ([]byte, []int) {
- return fileDescriptor_aebddaecf1fa8cdb, []int{0}
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP(), []int{0}
}
-func (m *ApiConfig) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_ApiConfig.Unmarshal(m, b)
-}
-func (m *ApiConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_ApiConfig.Marshal(b, m, deterministic)
-}
-func (m *ApiConfig) XXX_Merge(src proto.Message) {
- xxx_messageInfo_ApiConfig.Merge(m, src)
-}
-func (m *ApiConfig) XXX_Size() int {
- return xxx_messageInfo_ApiConfig.Size(m)
-}
-func (m *ApiConfig) XXX_DiscardUnknown() {
- xxx_messageInfo_ApiConfig.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ApiConfig proto.InternalMessageInfo
-
-func (m *ApiConfig) GetChannelPool() *ChannelPoolConfig {
- if m != nil {
- return m.ChannelPool
+func (x *ApiConfig) GetChannelPool() *ChannelPoolConfig {
+ if x != nil {
+ return x.ChannelPool
}
return nil
}
-func (m *ApiConfig) GetMethod() []*MethodConfig {
- if m != nil {
- return m.Method
+func (x *ApiConfig) GetMethod() []*MethodConfig {
+ if x != nil {
+ return x.Method
}
return nil
}
type ChannelPoolConfig struct {
- MaxSize uint32 `protobuf:"varint,1,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
- IdleTimeout uint64 `protobuf:"varint,2,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"`
- MaxConcurrentStreamsLowWatermark uint32 `protobuf:"varint,3,opt,name=max_concurrent_streams_low_watermark,json=maxConcurrentStreamsLowWatermark,proto3" json:"max_concurrent_streams_low_watermark,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ MaxSize uint32 `protobuf:"varint,1,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"`
+ IdleTimeout uint64 `protobuf:"varint,2,opt,name=idle_timeout,json=idleTimeout,proto3" json:"idle_timeout,omitempty"`
+ MaxConcurrentStreamsLowWatermark uint32 `protobuf:"varint,3,opt,name=max_concurrent_streams_low_watermark,json=maxConcurrentStreamsLowWatermark,proto3" json:"max_concurrent_streams_low_watermark,omitempty"`
}
-func (m *ChannelPoolConfig) Reset() { *m = ChannelPoolConfig{} }
-func (m *ChannelPoolConfig) String() string { return proto.CompactTextString(m) }
-func (*ChannelPoolConfig) ProtoMessage() {}
+func (x *ChannelPoolConfig) Reset() {
+ *x = ChannelPoolConfig{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChannelPoolConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChannelPoolConfig) ProtoMessage() {}
+
+func (x *ChannelPoolConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChannelPoolConfig.ProtoReflect.Descriptor instead.
func (*ChannelPoolConfig) Descriptor() ([]byte, []int) {
- return fileDescriptor_aebddaecf1fa8cdb, []int{1}
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP(), []int{1}
}
-func (m *ChannelPoolConfig) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_ChannelPoolConfig.Unmarshal(m, b)
-}
-func (m *ChannelPoolConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_ChannelPoolConfig.Marshal(b, m, deterministic)
-}
-func (m *ChannelPoolConfig) XXX_Merge(src proto.Message) {
- xxx_messageInfo_ChannelPoolConfig.Merge(m, src)
-}
-func (m *ChannelPoolConfig) XXX_Size() int {
- return xxx_messageInfo_ChannelPoolConfig.Size(m)
-}
-func (m *ChannelPoolConfig) XXX_DiscardUnknown() {
- xxx_messageInfo_ChannelPoolConfig.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_ChannelPoolConfig proto.InternalMessageInfo
-
-func (m *ChannelPoolConfig) GetMaxSize() uint32 {
- if m != nil {
- return m.MaxSize
+func (x *ChannelPoolConfig) GetMaxSize() uint32 {
+ if x != nil {
+ return x.MaxSize
}
return 0
}
-func (m *ChannelPoolConfig) GetIdleTimeout() uint64 {
- if m != nil {
- return m.IdleTimeout
+func (x *ChannelPoolConfig) GetIdleTimeout() uint64 {
+ if x != nil {
+ return x.IdleTimeout
}
return 0
}
-func (m *ChannelPoolConfig) GetMaxConcurrentStreamsLowWatermark() uint32 {
- if m != nil {
- return m.MaxConcurrentStreamsLowWatermark
+func (x *ChannelPoolConfig) GetMaxConcurrentStreamsLowWatermark() uint32 {
+ if x != nil {
+ return x.MaxConcurrentStreamsLowWatermark
}
return 0
}
type MethodConfig struct {
- Name []string `protobuf:"bytes,1,rep,name=name,proto3" json:"name,omitempty"`
- Affinity *AffinityConfig `protobuf:"bytes,1001,opt,name=affinity,proto3" json:"affinity,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name []string `protobuf:"bytes,1,rep,name=name,proto3" json:"name,omitempty"`
+ Affinity *AffinityConfig `protobuf:"bytes,1001,opt,name=affinity,proto3" json:"affinity,omitempty"`
}
-func (m *MethodConfig) Reset() { *m = MethodConfig{} }
-func (m *MethodConfig) String() string { return proto.CompactTextString(m) }
-func (*MethodConfig) ProtoMessage() {}
+func (x *MethodConfig) Reset() {
+ *x = MethodConfig{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MethodConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MethodConfig) ProtoMessage() {}
+
+func (x *MethodConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MethodConfig.ProtoReflect.Descriptor instead.
func (*MethodConfig) Descriptor() ([]byte, []int) {
- return fileDescriptor_aebddaecf1fa8cdb, []int{2}
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP(), []int{2}
}
-func (m *MethodConfig) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_MethodConfig.Unmarshal(m, b)
-}
-func (m *MethodConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_MethodConfig.Marshal(b, m, deterministic)
-}
-func (m *MethodConfig) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MethodConfig.Merge(m, src)
-}
-func (m *MethodConfig) XXX_Size() int {
- return xxx_messageInfo_MethodConfig.Size(m)
-}
-func (m *MethodConfig) XXX_DiscardUnknown() {
- xxx_messageInfo_MethodConfig.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_MethodConfig proto.InternalMessageInfo
-
-func (m *MethodConfig) GetName() []string {
- if m != nil {
- return m.Name
+func (x *MethodConfig) GetName() []string {
+ if x != nil {
+ return x.Name
}
return nil
}
-func (m *MethodConfig) GetAffinity() *AffinityConfig {
- if m != nil {
- return m.Affinity
+func (x *MethodConfig) GetAffinity() *AffinityConfig {
+ if x != nil {
+ return x.Affinity
}
return nil
}
type AffinityConfig struct {
- Command AffinityConfig_Command `protobuf:"varint,2,opt,name=command,proto3,enum=grpcbalancer.AffinityConfig_Command" json:"command,omitempty"`
- AffinityKey string `protobuf:"bytes,3,opt,name=affinity_key,json=affinityKey,proto3" json:"affinity_key,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Command AffinityConfig_Command `protobuf:"varint,2,opt,name=command,proto3,enum=grpcbalancer.AffinityConfig_Command" json:"command,omitempty"`
+ AffinityKey string `protobuf:"bytes,3,opt,name=affinity_key,json=affinityKey,proto3" json:"affinity_key,omitempty"`
}
-func (m *AffinityConfig) Reset() { *m = AffinityConfig{} }
-func (m *AffinityConfig) String() string { return proto.CompactTextString(m) }
-func (*AffinityConfig) ProtoMessage() {}
+func (x *AffinityConfig) Reset() {
+ *x = AffinityConfig{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AffinityConfig) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AffinityConfig) ProtoMessage() {}
+
+func (x *AffinityConfig) ProtoReflect() protoreflect.Message {
+ mi := &file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AffinityConfig.ProtoReflect.Descriptor instead.
func (*AffinityConfig) Descriptor() ([]byte, []int) {
- return fileDescriptor_aebddaecf1fa8cdb, []int{3}
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP(), []int{3}
}
-func (m *AffinityConfig) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_AffinityConfig.Unmarshal(m, b)
-}
-func (m *AffinityConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_AffinityConfig.Marshal(b, m, deterministic)
-}
-func (m *AffinityConfig) XXX_Merge(src proto.Message) {
- xxx_messageInfo_AffinityConfig.Merge(m, src)
-}
-func (m *AffinityConfig) XXX_Size() int {
- return xxx_messageInfo_AffinityConfig.Size(m)
-}
-func (m *AffinityConfig) XXX_DiscardUnknown() {
- xxx_messageInfo_AffinityConfig.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_AffinityConfig proto.InternalMessageInfo
-
-func (m *AffinityConfig) GetCommand() AffinityConfig_Command {
- if m != nil {
- return m.Command
+func (x *AffinityConfig) GetCommand() AffinityConfig_Command {
+ if x != nil {
+ return x.Command
}
return AffinityConfig_BOUND
}
-func (m *AffinityConfig) GetAffinityKey() string {
- if m != nil {
- return m.AffinityKey
+func (x *AffinityConfig) GetAffinityKey() string {
+ if x != nil {
+ return x.AffinityKey
}
return ""
}
-func init() {
- proto.RegisterEnum("grpcbalancer.AffinityConfig_Command", AffinityConfig_Command_name, AffinityConfig_Command_value)
- proto.RegisterType((*ApiConfig)(nil), "grpcbalancer.ApiConfig")
- proto.RegisterType((*ChannelPoolConfig)(nil), "grpcbalancer.ChannelPoolConfig")
- proto.RegisterType((*MethodConfig)(nil), "grpcbalancer.MethodConfig")
- proto.RegisterType((*AffinityConfig)(nil), "grpcbalancer.AffinityConfig")
+var File_go_pkg_balancer_proto_grpcbalancer_proto protoreflect.FileDescriptor
+
+var file_go_pkg_balancer_proto_grpcbalancer_proto_rawDesc = []byte{
+ 0x0a, 0x28, 0x67, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65,
+ 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x61, 0x6c, 0x61,
+ 0x6e, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x67, 0x72, 0x70, 0x63,
+ 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x41, 0x70, 0x69,
+ 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x42, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
+ 0x6c, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67,
+ 0x72, 0x70, 0x63, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x6e,
+ 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x6f, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x63,
+ 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x33, 0x0a, 0x06, 0x6d, 0x65,
+ 0x74, 0x68, 0x6f, 0x64, 0x18, 0xe9, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72,
+ 0x70, 0x63, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f,
+ 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22,
+ 0xa1, 0x01, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x6f, 0x6c, 0x43,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x7a,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65,
+ 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x69, 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65,
+ 0x6f, 0x75, 0x74, 0x12, 0x4e, 0x0a, 0x24, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x75,
+ 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x5f, 0x6c, 0x6f,
+ 0x77, 0x5f, 0x77, 0x61, 0x74, 0x65, 0x72, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x0d, 0x52, 0x20, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
+ 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x4c, 0x6f, 0x77, 0x57, 0x61, 0x74, 0x65, 0x72, 0x6d,
+ 0x61, 0x72, 0x6b, 0x22, 0x5d, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x43, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x61, 0x66, 0x66, 0x69, 0x6e,
+ 0x69, 0x74, 0x79, 0x18, 0xe9, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x72, 0x70,
+ 0x63, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x72, 0x2e, 0x41, 0x66, 0x66, 0x69, 0x6e, 0x69,
+ 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x61, 0x66, 0x66, 0x69, 0x6e, 0x69,
+ 0x74, 0x79, 0x22, 0x9f, 0x01, 0x0a, 0x0e, 0x41, 0x66, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x43,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x62, 0x61, 0x6c,
+ 0x61, 0x6e, 0x63, 0x65, 0x72, 0x2e, 0x41, 0x66, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x79, 0x43, 0x6f,
+ 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x66, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x66, 0x66,
+ 0x69, 0x6e, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x22, 0x2a, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d,
+ 0x61, 0x6e, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x08,
+ 0x0a, 0x04, 0x42, 0x49, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x42, 0x49,
+ 0x4e, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-func init() {
- proto.RegisterFile("go/pkg/balancer/proto/grpcbalancer.proto", fileDescriptor_aebddaecf1fa8cdb)
+var (
+ file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescOnce sync.Once
+ file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescData = file_go_pkg_balancer_proto_grpcbalancer_proto_rawDesc
+)
+
+func file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescGZIP() []byte {
+ file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescOnce.Do(func() {
+ file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescData = protoimpl.X.CompressGZIP(file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescData)
+ })
+ return file_go_pkg_balancer_proto_grpcbalancer_proto_rawDescData
}
-var fileDescriptor_aebddaecf1fa8cdb = []byte{
- // 386 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0xab, 0xd3, 0x40,
- 0x14, 0xc5, 0xcd, 0x6b, 0x6d, 0x9a, 0x9b, 0xf8, 0x78, 0xce, 0x2a, 0x8a, 0x60, 0x0c, 0x6f, 0x11,
- 0x5c, 0x34, 0xd0, 0xb7, 0x72, 0x23, 0xb4, 0xe9, 0x46, 0xd4, 0x28, 0xa9, 0xc5, 0x95, 0x84, 0x69,
- 0x3a, 0x4d, 0x87, 0x66, 0x66, 0xc2, 0x74, 0x4a, 0xff, 0xac, 0xfd, 0x1e, 0xe2, 0xc7, 0xf3, 0x5b,
- 0x48, 0x26, 0x49, 0x6d, 0x10, 0xde, 0x6e, 0x38, 0xf7, 0x77, 0x0e, 0xf7, 0x5c, 0x06, 0x82, 0x5c,
- 0x84, 0xe5, 0x36, 0x0f, 0x97, 0xb8, 0xc0, 0x3c, 0x23, 0x32, 0x2c, 0xa5, 0x50, 0x22, 0xcc, 0x65,
- 0x99, 0xb5, 0xd2, 0x48, 0x4b, 0xc8, 0xb9, 0xd6, 0xfc, 0x9f, 0x06, 0x58, 0x93, 0x92, 0x46, 0x82,
- 0xaf, 0x69, 0x8e, 0xa6, 0xe0, 0x64, 0x1b, 0xcc, 0x39, 0x29, 0xd2, 0x52, 0x88, 0xc2, 0xbd, 0xf1,
- 0x8c, 0xc0, 0x1e, 0xbf, 0x1e, 0x75, 0x62, 0xa2, 0x9a, 0xf8, 0x2a, 0x44, 0x51, 0xdb, 0x12, 0x3b,
- 0xfb, 0x27, 0xa1, 0x07, 0x18, 0x30, 0xa2, 0x36, 0x62, 0xe5, 0xfe, 0x31, 0xbd, 0x5e, 0x60, 0x8f,
- 0x5f, 0x76, 0xed, 0x9f, 0xf5, 0xb0, 0x71, 0x36, 0xa8, 0xff, 0xdb, 0x80, 0xe7, 0xff, 0xe5, 0xa2,
- 0x17, 0x30, 0x64, 0xf8, 0x98, 0xee, 0xe8, 0x99, 0xb8, 0x86, 0x67, 0x04, 0xcf, 0x12, 0x93, 0xe1,
- 0xe3, 0x9c, 0x9e, 0x09, 0x7a, 0x03, 0x0e, 0x5d, 0x15, 0x24, 0x55, 0x94, 0x11, 0xb1, 0x57, 0x7a,
- 0xd3, 0x7e, 0x62, 0x57, 0xda, 0xb7, 0x5a, 0x42, 0x31, 0xdc, 0x57, 0xee, 0x4c, 0xf0, 0x6c, 0x2f,
- 0x25, 0xe1, 0x2a, 0xdd, 0x29, 0x49, 0x30, 0xdb, 0xa5, 0x85, 0x38, 0xa4, 0x07, 0xac, 0x88, 0x64,
- 0x58, 0x6e, 0xdd, 0x9e, 0x4e, 0xf6, 0x18, 0x3e, 0x46, 0x17, 0x74, 0x5e, 0x93, 0x9f, 0xc4, 0xe1,
- 0x7b, 0xcb, 0xf9, 0x3f, 0xc0, 0xb9, 0xde, 0x1d, 0x21, 0xe8, 0x73, 0xcc, 0xaa, 0xcd, 0x7a, 0x81,
- 0x95, 0xe8, 0x37, 0x7a, 0x07, 0x43, 0xbc, 0x5e, 0x53, 0x4e, 0xd5, 0xa9, 0xaa, 0x5f, 0x5d, 0xef,
- 0x55, 0xb7, 0xfe, 0xa4, 0x19, 0x37, 0x07, 0xb8, 0xe0, 0xfe, 0x2f, 0x03, 0x6e, 0xbb, 0x43, 0xf4,
- 0x1e, 0xcc, 0x4c, 0x30, 0x86, 0xf9, 0x4a, 0xf7, 0xbb, 0x1d, 0xdf, 0x3f, 0x96, 0x35, 0x8a, 0x6a,
- 0x36, 0x69, 0x4d, 0xd5, 0x91, 0xda, 0xf8, 0x74, 0x4b, 0x4e, 0xba, 0xa9, 0x95, 0xd8, 0xad, 0xf6,
- 0x91, 0x9c, 0xfc, 0xb7, 0x60, 0x36, 0x36, 0x64, 0xc1, 0xd3, 0xe9, 0x97, 0x45, 0x3c, 0xbb, 0x7b,
- 0x82, 0x86, 0xd0, 0x9f, 0x7e, 0x88, 0x67, 0x77, 0x06, 0x02, 0x18, 0x2c, 0x62, 0xfd, 0xbe, 0x59,
- 0x0e, 0xf4, 0x07, 0x7a, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x38, 0x6e, 0x53, 0xd4, 0x6c, 0x02,
- 0x00, 0x00,
+var file_go_pkg_balancer_proto_grpcbalancer_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_go_pkg_balancer_proto_grpcbalancer_proto_goTypes = []interface{}{
+ (AffinityConfig_Command)(0), // 0: grpcbalancer.AffinityConfig.Command
+ (*ApiConfig)(nil), // 1: grpcbalancer.ApiConfig
+ (*ChannelPoolConfig)(nil), // 2: grpcbalancer.ChannelPoolConfig
+ (*MethodConfig)(nil), // 3: grpcbalancer.MethodConfig
+ (*AffinityConfig)(nil), // 4: grpcbalancer.AffinityConfig
+}
+var file_go_pkg_balancer_proto_grpcbalancer_proto_depIdxs = []int32{
+ 2, // 0: grpcbalancer.ApiConfig.channel_pool:type_name -> grpcbalancer.ChannelPoolConfig
+ 3, // 1: grpcbalancer.ApiConfig.method:type_name -> grpcbalancer.MethodConfig
+ 4, // 2: grpcbalancer.MethodConfig.affinity:type_name -> grpcbalancer.AffinityConfig
+ 0, // 3: grpcbalancer.AffinityConfig.command:type_name -> grpcbalancer.AffinityConfig.Command
+ 4, // [4:4] is the sub-list for method output_type
+ 4, // [4:4] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
+}
+
+func init() { file_go_pkg_balancer_proto_grpcbalancer_proto_init() }
+func file_go_pkg_balancer_proto_grpcbalancer_proto_init() {
+ if File_go_pkg_balancer_proto_grpcbalancer_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ApiConfig); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChannelPoolConfig); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*MethodConfig); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AffinityConfig); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_go_pkg_balancer_proto_grpcbalancer_proto_rawDesc,
+ NumEnums: 1,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_go_pkg_balancer_proto_grpcbalancer_proto_goTypes,
+ DependencyIndexes: file_go_pkg_balancer_proto_grpcbalancer_proto_depIdxs,
+ EnumInfos: file_go_pkg_balancer_proto_grpcbalancer_proto_enumTypes,
+ MessageInfos: file_go_pkg_balancer_proto_grpcbalancer_proto_msgTypes,
+ }.Build()
+ File_go_pkg_balancer_proto_grpcbalancer_proto = out.File
+ file_go_pkg_balancer_proto_grpcbalancer_proto_rawDesc = nil
+ file_go_pkg_balancer_proto_grpcbalancer_proto_goTypes = nil
+ file_go_pkg_balancer_proto_grpcbalancer_proto_depIdxs = nil
}
diff --git a/go/pkg/cas/BUILD.bazel b/go/pkg/cas/BUILD.bazel
index 8198f28..abd9c6b 100644
--- a/go/pkg/cas/BUILD.bazel
+++ b/go/pkg/cas/BUILD.bazel
@@ -15,11 +15,12 @@
"//go/pkg/retry",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
"@com_github_klauspost_compress//zstd:go_default_library",
"@com_github_pborman_uuid//:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@go_googleapis//google/bytestream:bytestream_go_proto",
+ "@org_golang_google_protobuf//encoding/protowire",
+ "@org_golang_google_protobuf//proto",
"@org_golang_google_api//support/bundler:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
@@ -40,7 +41,6 @@
"//go/pkg/digest",
"//go/pkg/fakes",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@org_golang_google_grpc//:go_default_library",
diff --git a/go/pkg/cas/upload.go b/go/pkg/cas/upload.go
index 15baa0b..12e1967 100644
--- a/go/pkg/cas/upload.go
+++ b/go/pkg/cas/upload.go
@@ -16,13 +16,14 @@
"time"
log "github.com/golang/glog"
- "github.com/golang/protobuf/proto"
"github.com/klauspost/compress/zstd"
"github.com/pborman/uuid"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
"google.golang.org/api/support/bundler"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/encoding/protowire"
+ "google.golang.org/protobuf/proto"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/cache"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
@@ -1199,7 +1200,7 @@
}
func marshalledFieldSize(size int64) int64 {
- return 1 + int64(proto.SizeVarint(uint64(size))) + size
+ return 1 + int64(protowire.SizeVarint(uint64(size))) + size
}
func marshalledRequestSize(d *repb.Digest) int64 {
@@ -1212,7 +1213,7 @@
// limit for incoming messages.
digestSize := marshalledFieldSize(int64(len(d.Hash)))
if d.SizeBytes > 0 {
- digestSize += 1 + int64(proto.SizeVarint(uint64(d.SizeBytes)))
+ digestSize += 1 + int64(protowire.SizeVarint(uint64(d.SizeBytes)))
}
reqSize := marshalledFieldSize(digestSize)
if d.SizeBytes > 0 {
diff --git a/go/pkg/cas/upload_test.go b/go/pkg/cas/upload_test.go
index 02e979d..fdf8f60 100644
--- a/go/pkg/cas/upload_test.go
+++ b/go/pkg/cas/upload_test.go
@@ -12,12 +12,12 @@
"testing"
"time"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/fakes"
diff --git a/go/pkg/client/BUILD.bazel b/go/pkg/client/BUILD.bazel
index d74b9a3..7e6ca1d 100644
--- a/go/pkg/client/BUILD.bazel
+++ b/go/pkg/client/BUILD.bazel
@@ -26,8 +26,6 @@
"//go/pkg/uploadinfo",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_klauspost_compress//zstd:go_default_library",
"@com_github_mostynb_zstdpool_syncpool//:go_default_library",
"@com_github_pborman_uuid//:go_default_library",
@@ -35,7 +33,11 @@
"@go_googleapis//google/bytestream:bytestream_go_proto",
"@go_googleapis//google/longrunning:longrunning_go_proto",
"@go_googleapis//google/rpc:errdetails_go_proto",
- "@io_bazel_rules_go//proto/wkt:empty_go_proto",
+ "@org_golang_google_protobuf//encoding/prototext",
+ "@org_golang_google_protobuf//encoding/protowire",
+ "@org_golang_google_protobuf//proto",
+ "@org_golang_google_protobuf//types/known/durationpb",
+ "@org_golang_google_protobuf//types/known/emptypb",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//credentials:go_default_library",
@@ -72,15 +74,14 @@
"//go/pkg/uploadinfo",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_bazelbuild_remote_apis//build/bazel/semver:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
"@com_github_klauspost_compress//zstd:go_default_library",
"@go_googleapis//google/bytestream:bytestream_go_proto",
"@go_googleapis//google/longrunning:longrunning_go_proto",
"@go_googleapis//google/rpc:status_go_proto",
- "@io_bazel_rules_go//proto/wkt:empty_go_proto",
+ "@org_golang_google_protobuf//types/known/anypb",
+ "@org_golang_google_protobuf//types/known/emptypb",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
diff --git a/go/pkg/client/batch_retries_test.go b/go/pkg/client/batch_retries_test.go
index 9e29c78..6ac41b9 100644
--- a/go/pkg/client/batch_retries_test.go
+++ b/go/pkg/client/batch_retries_test.go
@@ -12,11 +12,11 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/retry"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
diff --git a/go/pkg/client/cas.go b/go/pkg/client/cas.go
index b1f425f..5d31a9f 100644
--- a/go/pkg/client/cas.go
+++ b/go/pkg/client/cas.go
@@ -18,7 +18,6 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/filemetadata"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
- "github.com/golang/protobuf/proto"
"github.com/klauspost/compress/zstd"
syncpool "github.com/mostynb/zstdpool-syncpool"
"github.com/pborman/uuid"
@@ -26,6 +25,8 @@
"golang.org/x/sync/errgroup"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/encoding/protowire"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
log "github.com/golang/glog"
@@ -803,7 +804,7 @@
}
func marshalledFieldSize(size int64) int64 {
- return 1 + int64(proto.SizeVarint(uint64(size))) + size
+ return 1 + int64(protowire.SizeVarint(uint64(size))) + size
}
func marshalledRequestSize(d digest.Digest) int64 {
@@ -816,7 +817,7 @@
// limit for incoming messages.
digestSize := marshalledFieldSize(int64(len(d.Hash)))
if d.Size > 0 {
- digestSize += 1 + int64(proto.SizeVarint(uint64(d.Size)))
+ digestSize += 1 + int64(protowire.SizeVarint(uint64(d.Size)))
}
reqSize := marshalledFieldSize(digestSize)
if d.Size > 0 {
diff --git a/go/pkg/client/cas_test.go b/go/pkg/client/cas_test.go
index 0cde18c..3a84536 100644
--- a/go/pkg/client/cas_test.go
+++ b/go/pkg/client/cas_test.go
@@ -21,12 +21,12 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/filemetadata"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/portpicker"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
bsgrpc "google.golang.org/genproto/googleapis/bytestream"
diff --git a/go/pkg/client/client.go b/go/pkg/client/client.go
index ab9f3a7..a62f736 100644
--- a/go/pkg/client/client.go
+++ b/go/pkg/client/client.go
@@ -30,11 +30,11 @@
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
log "github.com/golang/glog"
- emptypb "github.com/golang/protobuf/ptypes/empty"
bsgrpc "google.golang.org/genproto/googleapis/bytestream"
bspb "google.golang.org/genproto/googleapis/bytestream"
opgrpc "google.golang.org/genproto/googleapis/longrunning"
oppb "google.golang.org/genproto/googleapis/longrunning"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
)
const (
diff --git a/go/pkg/client/client_context.go b/go/pkg/client/client_context.go
index abaeecf..3a4b69c 100644
--- a/go/pkg/client/client_context.go
+++ b/go/pkg/client/client_context.go
@@ -7,9 +7,9 @@
"fmt"
log "github.com/golang/glog"
- "github.com/golang/protobuf/proto"
"github.com/pborman/uuid"
"google.golang.org/grpc/metadata"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
)
diff --git a/go/pkg/client/exec.go b/go/pkg/client/exec.go
index be185be..a4cab54 100644
--- a/go/pkg/client/exec.go
+++ b/go/pkg/client/exec.go
@@ -9,15 +9,15 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
log "github.com/golang/glog"
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
gerrors "github.com/pkg/errors"
oppb "google.golang.org/genproto/googleapis/longrunning"
+ dpb "google.golang.org/protobuf/types/known/durationpb"
)
const (
@@ -128,7 +128,7 @@
return nil, StatusDetailedError(status.FromProto(r.Error))
case *oppb.Operation_Response:
res := new(repb.ExecuteResponse)
- if err := ptypes.UnmarshalAny(r.Response, res); err != nil {
+ if err := r.Response.UnmarshalTo(res); err != nil {
return nil, gerrors.WithMessage(err, "extracting ExecuteResponse from execution operation")
}
if st := status.FromProto(res.Status); st.Code() != codes.OK {
@@ -158,7 +158,7 @@
// Only set timeout if it's non-zero, because Timeout needs to be nil for the server to use a
// default.
if ac.Timeout != 0 {
- reAc.Timeout = ptypes.DurationProto(ac.Timeout)
+ reAc.Timeout = dpb.New(ac.Timeout)
}
acBlob, err := proto.Marshal(reAc)
@@ -251,7 +251,7 @@
lastOp = op
if progress != nil {
metadata := &repb.ExecuteOperationMetadata{}
- if err := ptypes.UnmarshalAny(op.Metadata, metadata); err == nil {
+ if err := op.Metadata.UnmarshalTo(metadata); err == nil {
progress(metadata)
}
}
@@ -285,7 +285,7 @@
return nil
}
respv2 := &repb.ExecuteResponse{}
- if err := ptypes.UnmarshalAny(r.Response, respv2); err != nil {
+ if err := r.Response.UnmarshalTo(respv2); err != nil {
return nil
}
if s, ok := status.FromError(status.FromProto(respv2.Status).Err()); ok {
diff --git a/go/pkg/client/exec_test.go b/go/pkg/client/exec_test.go
index 858550d..30cdc79 100644
--- a/go/pkg/client/exec_test.go
+++ b/go/pkg/client/exec_test.go
@@ -4,19 +4,19 @@
"testing"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
- "github.com/golang/protobuf/ptypes"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
oppb "google.golang.org/genproto/googleapis/longrunning"
spb "google.golang.org/genproto/googleapis/rpc/status"
+ anypb "google.golang.org/protobuf/types/known/anypb"
)
func TestOperationStatus(t *testing.T) {
- respv2, err := ptypes.MarshalAny(&repb.ExecuteResponse{Status: &spb.Status{Code: 2}})
+ respv2, err := anypb.New(&repb.ExecuteResponse{Status: &spb.Status{Code: 2}})
if err != nil {
t.Fatalf("Unable to marshal V2 proto: %s", err)
}
- respOther, err := ptypes.MarshalAny(&spb.Status{Code: 3})
+ respOther, err := anypb.New(&spb.Status{Code: 3})
if err != nil {
t.Fatalf("Unable to marshal status proto: %s", err)
}
diff --git a/go/pkg/client/retries_test.go b/go/pkg/client/retries_test.go
index 8ba0c8a..5d83d93 100644
--- a/go/pkg/client/retries_test.go
+++ b/go/pkg/client/retries_test.go
@@ -15,7 +15,6 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
- "github.com/golang/protobuf/ptypes"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/klauspost/compress/zstd"
@@ -25,11 +24,12 @@
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
- emptypb "github.com/golang/protobuf/ptypes/empty"
bsgrpc "google.golang.org/genproto/googleapis/bytestream"
bspb "google.golang.org/genproto/googleapis/bytestream"
opgrpc "google.golang.org/genproto/googleapis/longrunning"
oppb "google.golang.org/genproto/googleapis/longrunning"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
)
var zstdEncoder, _ = zstd.NewWriter(nil, zstd.WithZeroFrames(true))
@@ -191,7 +191,7 @@
// Execute (above) will fail twice (and be retried twice) before ExecuteAndWait() switches to
// WaitExecution. WaitExecution will fail 4 more times more before succeeding, for a total of 6 retries.
execResp := &repb.ExecuteResponse{Status: status.New(codes.Aborted, "transient operation failure!").Proto()}
- any, e := ptypes.MarshalAny(execResp)
+ any, e := anypb.New(execResp)
if e != nil {
return e
}
diff --git a/go/pkg/client/status.go b/go/pkg/client/status.go
index 1e663e0..c5a9308 100644
--- a/go/pkg/client/status.go
+++ b/go/pkg/client/status.go
@@ -4,8 +4,9 @@
"fmt"
"strings"
- "github.com/golang/protobuf/proto"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/encoding/prototext"
+ "google.golang.org/protobuf/proto"
_ "google.golang.org/genproto/googleapis/rpc/errdetails" // the proto needs to be compiled in for unmarshalling of status details.
)
@@ -22,7 +23,7 @@
for _, d := range st.Details() {
s := fmt.Sprintf("%+v", d)
if pb, ok := d.(proto.Message); ok {
- s = proto.MarshalTextString(pb)
+ s = prototext.Format(pb)
}
details = append(details, s)
}
diff --git a/go/pkg/client/tree_test.go b/go/pkg/client/tree_test.go
index 2b6c19b..8ecf8b9 100644
--- a/go/pkg/client/tree_test.go
+++ b/go/pkg/client/tree_test.go
@@ -14,9 +14,9 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/fakes"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/filemetadata"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
)
diff --git a/go/pkg/command/BUILD.bazel b/go/pkg/command/BUILD.bazel
index b8c631b..fdc6f58 100644
--- a/go/pkg/command/BUILD.bazel
+++ b/go/pkg/command/BUILD.bazel
@@ -10,9 +10,8 @@
"//go/pkg/digest",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_pborman_uuid//:go_default_library",
- "@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
+ "@org_golang_google_protobuf//types/known/timestamppb",
],
)
@@ -22,8 +21,8 @@
embed = [":command"],
deps = [
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
+ "@org_golang_google_protobuf//proto",
],
)
diff --git a/go/pkg/command/command.go b/go/pkg/command/command.go
index f90133e..2b95a7a 100644
--- a/go/pkg/command/command.go
+++ b/go/pkg/command/command.go
@@ -12,13 +12,11 @@
"time"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
- "github.com/golang/protobuf/ptypes"
"github.com/pborman/uuid"
cpb "github.com/bazelbuild/remote-apis-sdks/go/api/command"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
- log "github.com/golang/glog"
- tspb "github.com/golang/protobuf/ptypes/timestamp"
+ tspb "google.golang.org/protobuf/types/known/timestamppb"
)
// InputType can be specified to narrow down the matching for a given input path.
@@ -795,12 +793,7 @@
if t.IsZero() {
return nil
}
- ts, err := ptypes.TimestampProto(t)
- if err != nil {
- log.Warningf("Unable to convert time to Timestamp: %v", err)
- return nil
- }
- return ts
+ return tspb.New(t)
}
// TimeFromProto converts a valid Timestamp proto into a time.Time.
@@ -808,11 +801,7 @@
if tPb == nil {
return time.Time{}
}
- t, err := ptypes.Timestamp(tPb)
- if err != nil {
- log.Errorf("Failed to parse RBE timestamp: %+v - > %v", tPb, err)
- }
- return t
+ return tPb.AsTime()
}
// TimeIntervalToProto serializes the SDK TimeInterval into a proto.
diff --git a/go/pkg/command/command_test.go b/go/pkg/command/command_test.go
index e9f4a09..185f2c7 100644
--- a/go/pkg/command/command_test.go
+++ b/go/pkg/command/command_test.go
@@ -5,9 +5,9 @@
"testing"
"time"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
)
diff --git a/go/pkg/digest/BUILD.bazel b/go/pkg/digest/BUILD.bazel
index 12bf52e..df5b3d2 100644
--- a/go/pkg/digest/BUILD.bazel
+++ b/go/pkg/digest/BUILD.bazel
@@ -7,7 +7,7 @@
visibility = ["//visibility:public"],
deps = [
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
+ "@org_golang_google_protobuf//proto",
],
)
@@ -15,5 +15,4 @@
name = "digest_test",
srcs = ["digest_test.go"],
embed = [":digest"],
- deps = ["@com_github_golang_protobuf//proto:go_default_library"],
)
diff --git a/go/pkg/digest/digest.go b/go/pkg/digest/digest.go
index a60fe49..490480a 100644
--- a/go/pkg/digest/digest.go
+++ b/go/pkg/digest/digest.go
@@ -12,7 +12,7 @@
"strings"
"sync"
- "github.com/golang/protobuf/proto"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
)
diff --git a/go/pkg/digest/digest_test.go b/go/pkg/digest/digest_test.go
index 95d9b83..8549bbc 100644
--- a/go/pkg/digest/digest_test.go
+++ b/go/pkg/digest/digest_test.go
@@ -8,7 +8,7 @@
"strings"
"testing"
- "github.com/golang/protobuf/proto"
+ "google.golang.org/protobuf/proto"
)
var (
diff --git a/go/pkg/fakes/BUILD.bazel b/go/pkg/fakes/BUILD.bazel
index ecafb1b..894319a 100644
--- a/go/pkg/fakes/BUILD.bazel
+++ b/go/pkg/fakes/BUILD.bazel
@@ -20,13 +20,14 @@
"//go/pkg/uploadinfo",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_klauspost_compress//zstd:go_default_library",
"@com_github_pborman_uuid//:go_default_library",
"@go_googleapis//google/bytestream:bytestream_go_proto",
"@go_googleapis//google/longrunning:longrunning_go_proto",
- "@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
+ "@org_golang_google_protobuf//proto",
+ "@org_golang_google_protobuf//types/known/anypb",
+ "@org_golang_google_protobuf//types/known/durationpb",
+ "@org_golang_google_protobuf//types/known/timestamppb",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
diff --git a/go/pkg/fakes/cas.go b/go/pkg/fakes/cas.go
index e001f3a..4d0c7c9 100644
--- a/go/pkg/fakes/cas.go
+++ b/go/pkg/fakes/cas.go
@@ -16,11 +16,11 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
- "github.com/golang/protobuf/proto"
"github.com/klauspost/compress/zstd"
"github.com/pborman/uuid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
diff --git a/go/pkg/fakes/exec.go b/go/pkg/fakes/exec.go
index 432d245..43e2b9a 100644
--- a/go/pkg/fakes/exec.go
+++ b/go/pkg/fakes/exec.go
@@ -8,14 +8,14 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
oppb "google.golang.org/genproto/googleapis/longrunning"
+ anypb "google.golang.org/protobuf/types/known/anypb"
)
// Exec implements the complete RE execution interface for a single execution, returning a fixed
@@ -98,7 +98,7 @@
Status: st.Proto(),
CachedResult: cached,
}
- any, err := ptypes.MarshalAny(execResp)
+ any, err := anypb.New(execResp)
if err != nil {
return nil, err
}
diff --git a/go/pkg/fakes/server.go b/go/pkg/fakes/server.go
index c58eb52..1737ffa 100644
--- a/go/pkg/fakes/server.go
+++ b/go/pkg/fakes/server.go
@@ -17,18 +17,17 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/filemetadata"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/rexec"
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
rc "github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
- log "github.com/golang/glog"
- tspb "github.com/golang/protobuf/ptypes/timestamp"
bsgrpc "google.golang.org/genproto/googleapis/bytestream"
+ dpb "google.golang.org/protobuf/types/known/durationpb"
+ tspb "google.golang.org/protobuf/types/known/timestamppb"
)
// Server is a configurable fake in-process RBE server for use in integration tests.
@@ -136,12 +135,7 @@
if t.IsZero() {
return nil
}
- ts, err := ptypes.TimestampProto(t)
- if err != nil {
- log.Warningf("Unable to convert time to Timestamp: %v", err.Error())
- return nil
- }
- return ts
+ return tspb.New(t)
}
// Set sets up the fake to return the given result on the given command execution.
@@ -206,7 +200,7 @@
DoNotCache: opt.DoNotCache,
}
if cmd.Timeout > 0 {
- ac.Timeout = ptypes.DurationProto(cmd.Timeout)
+ ac.Timeout = dpb.New(cmd.Timeout)
}
acDg = digest.TestNewFromMessage(ac)
diff --git a/go/pkg/filemetadata/cache_posix_test.go b/go/pkg/filemetadata/cache_posix_test.go
index 3b26fb8..f8c8cda 100644
--- a/go/pkg/filemetadata/cache_posix_test.go
+++ b/go/pkg/filemetadata/cache_posix_test.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package filemetadata
diff --git a/go/pkg/rexec/BUILD.bazel b/go/pkg/rexec/BUILD.bazel
index 4d27626..94f43f4 100644
--- a/go/pkg/rexec/BUILD.bazel
+++ b/go/pkg/rexec/BUILD.bazel
@@ -14,9 +14,10 @@
"//go/pkg/uploadinfo",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
- "@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
+ "@org_golang_google_protobuf//encoding/prototext",
+ "@org_golang_google_protobuf//types/known/anypb",
+ "@org_golang_google_protobuf//types/known/durationpb",
+ "@org_golang_google_protobuf//types/known/timestamppb",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
@@ -31,9 +32,9 @@
"//go/pkg/fakes",
"//go/pkg/outerr",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
+ "@org_golang_google_protobuf//proto",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
diff --git a/go/pkg/rexec/rexec.go b/go/pkg/rexec/rexec.go
index dd118ba..516faa0 100644
--- a/go/pkg/rexec/rexec.go
+++ b/go/pkg/rexec/rexec.go
@@ -13,15 +13,15 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/filemetadata"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/outerr"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/encoding/prototext"
rc "github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
log "github.com/golang/glog"
- tspb "github.com/golang/protobuf/ptypes/timestamp"
+ dpb "google.golang.org/protobuf/types/known/durationpb"
+ tspb "google.golang.org/protobuf/types/known/timestamppb"
)
// Client is a remote execution client.
@@ -156,7 +156,7 @@
cmdID, executionID := ec.cmd.Identifiers.ExecutionID, ec.cmd.Identifiers.CommandID
commandHasOutputPathsField := ec.client.GrpcClient.SupportsCommandOutputPaths()
cmdPb := ec.cmd.ToREProto(commandHasOutputPathsField)
- log.V(2).Infof("%s %s> Command: \n%s\n", cmdID, executionID, proto.MarshalTextString(cmdPb))
+ log.V(2).Infof("%s %s> Command: \n%s\n", cmdID, executionID, prototext.Format(cmdPb))
var err error
if ec.cmdUe, err = uploadinfo.EntryFromProto(cmdPb); err != nil {
return err
@@ -185,7 +185,7 @@
}
if ec.cmd.Timeout > 0 {
- acPb.Timeout = ptypes.DurationProto(ec.cmd.Timeout)
+ acPb.Timeout = dpb.New(ec.cmd.Timeout)
}
if ec.acUe, err = uploadinfo.EntryFromProto(acPb); err != nil {
return err
@@ -336,7 +336,7 @@
return
}
resp := &repb.ExecuteResponse{}
- if err := ptypes.UnmarshalAny(or, resp); err != nil {
+ if err := or.UnmarshalTo(resp); err != nil {
ec.Result = command.NewRemoteErrorResult(err)
return
}
@@ -426,11 +426,7 @@
if tPb == nil {
return time.Time{}
}
- t, err := ptypes.Timestamp(tPb)
- if err != nil {
- log.Errorf("Failed to parse RBE timestamp: %+v - > %v", tPb, err)
- }
- return t
+ return tPb.AsTime()
}
func setEventTimes(cm *command.Metadata, event string, start, end *tspb.Timestamp) {
diff --git a/go/pkg/rexec/rexec_test.go b/go/pkg/rexec/rexec_test.go
index 6a8a770..bfe9d79 100644
--- a/go/pkg/rexec/rexec_test.go
+++ b/go/pkg/rexec/rexec_test.go
@@ -14,11 +14,11 @@
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/fakes"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/outerr"
- "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
)
diff --git a/go/pkg/tool/BUILD.bazel b/go/pkg/tool/BUILD.bazel
index bc04f1a..287ad7f 100644
--- a/go/pkg/tool/BUILD.bazel
+++ b/go/pkg/tool/BUILD.bazel
@@ -16,9 +16,9 @@
"//go/pkg/uploadinfo",
"@com_github_bazelbuild_remote_apis//build/bazel/remote/execution/v2:go_default_library",
"@com_github_golang_glog//:go_default_library",
- "@com_github_golang_protobuf//proto:go_default_library",
- "@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_pkg_errors//:go_default_library",
+ "@org_golang_google_protobuf//encoding/prototext",
+ "@org_golang_google_protobuf//proto",
"@org_golang_x_sync//errgroup:go_default_library",
],
)
diff --git a/go/pkg/tool/tool.go b/go/pkg/tool/tool.go
index a27b612..9b7f6da 100644
--- a/go/pkg/tool/tool.go
+++ b/go/pkg/tool/tool.go
@@ -14,10 +14,10 @@
"time"
log "github.com/golang/glog"
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
+ "google.golang.org/protobuf/encoding/prototext"
+ "google.golang.org/protobuf/proto"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/cas"
rc "github.com/bazelbuild/remote-apis-sdks/go/pkg/client"
@@ -126,11 +126,7 @@
cmd.InputSpec.Inputs = inputPaths
cmd.ExecRoot = inputRoot
if actionProto.Timeout != nil {
- tm, err := ptypes.Duration(actionProto.Timeout)
- if err != nil {
- return nil, err
- }
- cmd.Timeout = tm
+ cmd.Timeout = actionProto.Timeout.AsDuration()
}
return cmd, nil
}
@@ -323,7 +319,7 @@
return err
}
defer f.Close()
- f.WriteString(proto.MarshalTextString(m))
+ f.WriteString(prototext.Format(m))
return nil
}
@@ -377,7 +373,7 @@
return "", err
}
cmdProto := &repb.Command{}
- if err := proto.UnmarshalText(string(cmdTxt), cmdProto); err != nil {
+ if err := prototext.Unmarshal(cmdTxt, cmdProto); err != nil {
return "", err
}
cmdPb, err := proto.Marshal(cmdProto)
@@ -393,7 +389,7 @@
return "", err
}
actionProto := &repb.Action{}
- if err := proto.UnmarshalText(string(ac), actionProto); err != nil {
+ if err := prototext.Unmarshal(ac, actionProto); err != nil {
return "", err
}
actionProto.CommandDigest = digest.NewFromBlob(cmdPb).ToProto()
@@ -484,10 +480,7 @@
}
if actionProto.Timeout != nil {
- timeout, err := ptypes.Duration(actionProto.Timeout)
- if err != nil {
- return "", err
- }
+ timeout := actionProto.Timeout.AsDuration()
showActionRes.WriteString(fmt.Sprintf("Timeout: %s\n", timeout.String()))
}
diff --git a/go/pkg/uploadinfo/BUILD.bazel b/go/pkg/uploadinfo/BUILD.bazel
index 3c4e613..1795eba 100644
--- a/go/pkg/uploadinfo/BUILD.bazel
+++ b/go/pkg/uploadinfo/BUILD.bazel
@@ -7,6 +7,6 @@
visibility = ["//visibility:public"],
deps = [
"//go/pkg/digest",
- "@com_github_golang_protobuf//proto:go_default_library",
+ "@org_golang_google_protobuf//proto",
],
)
diff --git a/go/pkg/uploadinfo/entry.go b/go/pkg/uploadinfo/entry.go
index 33e3c6a..212319f 100644
--- a/go/pkg/uploadinfo/entry.go
+++ b/go/pkg/uploadinfo/entry.go
@@ -4,7 +4,7 @@
import (
"github.com/bazelbuild/remote-apis-sdks/go/pkg/digest"
- "github.com/golang/protobuf/proto"
+ "google.golang.org/protobuf/proto"
)
const (
diff --git a/remote-apis-sdks-deps.bzl b/remote-apis-sdks-deps.bzl
index a050f1c..600a064 100644
--- a/remote-apis-sdks-deps.bzl
+++ b/remote-apis-sdks-deps.bzl
@@ -16,9 +16,9 @@
)
_maybe(
go_repository,
- name = "com_github_golang_protobuf",
- importpath = "github.com/golang/protobuf",
- tag = "v1.4.2",
+ name = "org_golang_google_protobuf",
+ importpath = "google.golang.org/protobuf",
+ tag = "v1.27.1",
)
_maybe(
go_repository,