Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update grpc #410

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions errors/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion gateway/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
6 changes: 3 additions & 3 deletions gorm/collection_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"fmt"
"strings"

"github.com/golang/protobuf/proto"
"github.com/jinzhu/gorm"
"google.golang.org/protobuf"

Check failure on line 9 in gorm/collection_operators.go

View workflow job for this annotation

GitHub Actions / test

import "google.golang.org/protobuf" is a program, not an importable package

Check failure on line 9 in gorm/collection_operators.go

View workflow job for this annotation

GitHub Actions / lint

could not import google.golang.org/protobuf (-: no non-test Go files in /home/runner/go/pkg/mod/google.golang.org/[email protected]) (typecheck)

"github.com/infobloxopen/atlas-app-toolkit/v2/query"
)
Expand Down Expand Up @@ -144,13 +144,13 @@

// 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)
}
Expand Down
4 changes: 2 additions & 2 deletions gorm/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion gorm/filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion gorm/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion gorm/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion gorm/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 3 additions & 3 deletions query/filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"regexp"
"strings"

"github.com/golang/protobuf/proto"
"google.golang.org/protobuf"

Check failure on line 9 in query/filtering.go

View workflow job for this annotation

GitHub Actions / test

import "google.golang.org/protobuf" is a program, not an importable package

Check failure on line 9 in query/filtering.go

View workflow job for this annotation

GitHub Actions / test

cannot find module providing package google.golang.org/protobuf: import lookup disabled by -mod=vendor
)

// Filter is a shortcut to parse a filter string using default FilteringParser implementation
Expand Down Expand Up @@ -234,7 +234,7 @@

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)
Expand All @@ -243,7 +243,7 @@

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)
Expand Down
6 changes: 3 additions & 3 deletions query/filtering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"regexp/syntax"
"testing"

"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf"

Check failure on line 8 in query/filtering_test.go

View workflow job for this annotation

GitHub Actions / lint

import "google.golang.org/protobuf" is a program, not an importable package (typecheck)
)

type TestObject struct {
Expand All @@ -22,15 +22,15 @@
}

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 {
Str string `protobuf:"bytes,1,opt,name=str"`
}

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) {
Expand Down
2 changes: 1 addition & 1 deletion rpc/resource/jsonpb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rpc/resource/jsonpb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"bytes"

"github.com/golang/protobuf/jsonpb"
jsonpb "google.golang.org/protobuf/encoding/protojson"
)

func TestIdentifier_MarshalJSONPB(t *testing.T) {
Expand Down
Loading