diff --git a/errors/container.go b/errors/container.go index e07b3e00..b93bc1a5 100644 --- a/errors/container.go +++ b/errors/container.go @@ -10,8 +10,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/errdetails" "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/errfields" diff --git a/gateway/middleware.go b/gateway/middleware.go index 2a682cd7..733e5e58 100644 --- a/gateway/middleware.go +++ b/gateway/middleware.go @@ -5,10 +5,10 @@ import ( "fmt" "reflect" - "github.com/golang/protobuf/proto" "github.com/infobloxopen/atlas-app-toolkit/v2/query" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" + "google.golang.org/protobuf/proto" ) // UnaryServerInterceptor returns grpc.UnaryServerInterceptor diff --git a/go.mod b/go.mod index 077d1bbe..e3d942cf 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/lib/pq v1.3.1-0.20200116171513-9eb3fc897d6f github.com/sirupsen/logrus v1.9.3 github.com/speps/go-hashids/v2 v2.0.1 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.7.0 go.opencensus.io v0.22.4 golang.org/x/net v0.20.0 google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced diff --git a/go.sum b/go.sum index c88a4c13..01bd234e 100644 --- a/go.sum +++ b/go.sum @@ -185,9 +185,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/gorm/collection_operators.go b/gorm/collection_operators.go index bd4a37ce..c04aeab6 100644 --- a/gorm/collection_operators.go +++ b/gorm/collection_operators.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - "github.com/golang/protobuf/proto" "github.com/jinzhu/gorm" + "google.golang.org/protobuf" "github.com/infobloxopen/atlas-app-toolkit/v2/query" ) @@ -144,13 +144,13 @@ func ApplySortingEx(ctx context.Context, db *gorm.DB, s *query.Sorting, obj inte // Deprecated: use ApplyCollectionOperatorsEx instead // ApplyCollectionOperators applies collection operators to gorm instance db. -func ApplyCollectionOperators(ctx context.Context, db *gorm.DB, obj interface{}, pb proto.Message, f *query.Filtering, s *query.Sorting, p *query.Pagination, fs *query.FieldSelection) (*gorm.DB, error) { +func ApplyCollectionOperators(ctx context.Context, db *gorm.DB, obj interface{}, pb protobuf.Message, f *query.Filtering, s *query.Sorting, p *query.Pagination, fs *query.FieldSelection) (*gorm.DB, error) { return ApplyCollectionOperatorsEx(ctx, db, obj, NewDefaultPbToOrmConverter(pb), f, s, p, fs) } // Deprecated: use ApplyFilteringEx instead // ApplyFiltering applies filtering operator f to gorm instance db. -func ApplyFiltering(ctx context.Context, db *gorm.DB, f *query.Filtering, obj interface{}, pb proto.Message) (*gorm.DB, map[string]struct{}, error) { +func ApplyFiltering(ctx context.Context, db *gorm.DB, f *query.Filtering, obj interface{}, pb protobuf.Message) (*gorm.DB, map[string]struct{}, error) { c := &DefaultFilteringConditionConverter{&DefaultFilteringConditionProcessor{pb}} return ApplyFilteringEx(ctx, db, f, obj, c) } diff --git a/gorm/converter.go b/gorm/converter.go index 4720df4e..93ff9ba7 100644 --- a/gorm/converter.go +++ b/gorm/converter.go @@ -6,8 +6,8 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/jsonpb" - "github.com/golang/protobuf/proto" + jsonpb "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" "github.com/infobloxopen/atlas-app-toolkit/v2/query" "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/resource" diff --git a/gorm/filtering.go b/gorm/filtering.go index 2a226c9d..1385c83e 100644 --- a/gorm/filtering.go +++ b/gorm/filtering.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "github.com/infobloxopen/atlas-app-toolkit/v2/query" ) diff --git a/gorm/resource/resource.go b/gorm/resource/resource.go index 34e16b37..c0870c40 100644 --- a/gorm/resource/resource.go +++ b/gorm/resource/resource.go @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" resourcepb "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/resource" "github.com/infobloxopen/atlas-app-toolkit/v2/util" diff --git a/gorm/resource/resource_test.go b/gorm/resource/resource_test.go index 528f4418..86c51b65 100644 --- a/gorm/resource/resource_test.go +++ b/gorm/resource/resource_test.go @@ -10,8 +10,8 @@ import ( "bytes" - "github.com/golang/protobuf/proto" resourcepb "github.com/infobloxopen/atlas-app-toolkit/v2/rpc/resource" + "google.golang.org/protobuf/proto" ) type TestCodec struct{} diff --git a/gorm/utilities.go b/gorm/utilities.go index ce163476..d330aca4 100644 --- a/gorm/utilities.go +++ b/gorm/utilities.go @@ -7,10 +7,10 @@ import ( "reflect" "strings" - "github.com/golang/protobuf/proto" jgorm "github.com/jinzhu/gorm" "github.com/jinzhu/gorm/dialects/postgres" "github.com/jinzhu/inflection" + "google.golang.org/protobuf/proto" "time" diff --git a/query/filtering.go b/query/filtering.go index 2cc45e3c..60ffb1e7 100644 --- a/query/filtering.go +++ b/query/filtering.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf" ) // Filter is a shortcut to parse a filter string using default FilteringParser implementation @@ -234,7 +234,7 @@ func floatInSlice(digit float64, slice []float64) bool { func fieldByFieldPath(obj interface{}, fieldPath []string) reflect.Value { switch obj.(type) { - case proto.Message: + case protobuf.Message: return fieldByProtoPath(obj, fieldPath) default: return fieldByJSONPath(obj, fieldPath) @@ -243,7 +243,7 @@ func fieldByFieldPath(obj interface{}, fieldPath []string) reflect.Value { func fieldByProtoPath(obj interface{}, protoPath []string) reflect.Value { v := dereferenceValue(reflect.ValueOf(obj)) - props := proto.GetProperties(v.Type()) + props := protobuf.GetProperties(v.Type()) for _, p := range props.Prop { if p.OrigName == protoPath[0] { return v.FieldByName(p.Name) diff --git a/query/filtering_test.go b/query/filtering_test.go index 51e70226..65a79cdc 100644 --- a/query/filtering_test.go +++ b/query/filtering_test.go @@ -4,8 +4,8 @@ import ( "regexp/syntax" "testing" - "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" + "google.golang.org/protobuf" ) type TestObject struct { @@ -22,7 +22,7 @@ type TestProtoMessage struct { } func (m *TestProtoMessage) Reset() { *m = TestProtoMessage{} } -func (m *TestProtoMessage) String() string { return proto.CompactTextString(m) } +func (m *TestProtoMessage) String() string { return protobuf.CompactTextString(m) } func (*TestProtoMessage) ProtoMessage() {} type NestedMessage struct { @@ -30,7 +30,7 @@ type NestedMessage struct { } func (m *NestedMessage) Reset() { *m = NestedMessage{} } -func (m *NestedMessage) String() string { return proto.CompactTextString(m) } +func (m *NestedMessage) String() string { return protobuf.CompactTextString(m) } func (*NestedMessage) ProtoMessage() {} func TestFiltering(t *testing.T) { diff --git a/rpc/resource/jsonpb.go b/rpc/resource/jsonpb.go index 275ada9e..84fbb23c 100644 --- a/rpc/resource/jsonpb.go +++ b/rpc/resource/jsonpb.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strings" - "github.com/golang/protobuf/jsonpb" + jsonpb "google.golang.org/protobuf/encoding/protojson" ) // MarshalJSONPB implements jsonpb.JSONPBMarshaler interface by marshal diff --git a/rpc/resource/jsonpb_test.go b/rpc/resource/jsonpb_test.go index f53c1b24..958f2a98 100644 --- a/rpc/resource/jsonpb_test.go +++ b/rpc/resource/jsonpb_test.go @@ -5,7 +5,7 @@ import ( "bytes" - "github.com/golang/protobuf/jsonpb" + jsonpb "google.golang.org/protobuf/encoding/protojson" ) func TestIdentifier_MarshalJSONPB(t *testing.T) {