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

revert v0.10.5 and bump v0.10.6 #533

Merged
merged 2 commits into from
Apr 26, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[meta]
autoupdate = false
configversion = "0.10.5"
configversion = "0.10.6"
updatelevel = "patch"

[repl]
Expand Down
17 changes: 0 additions & 17 deletions e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,6 @@ func TestE2E_CLI(t *testing.T) {
unflatten: true,
assertWithGolden: true,
},
"call failure unary RPC with --enrich flag without reflection": {
commonFlags: "--proto testdata/test.proto",
cmd: "call",
args: "--file testdata/unary_call.in --enrich api.Example.UnaryHeaderTrailerFailure",
unflatten: true,
assertWithGolden: true,
expectedCode: 1,
},
"call failure unary RPC with --enrich flag": {
commonFlags: "-r",
cmd: "call",
Expand Down Expand Up @@ -550,15 +542,6 @@ func TestE2E_CLI(t *testing.T) {
unflatten: true,
assertWithGolden: true,
},
"call failure unary RPC with --enrich flag without reflection against to gRPC-Web server": {
commonFlags: "--web --proto testdata/test.proto",
cmd: "call",
args: "--file testdata/unary_call.in --enrich api.Example.UnaryHeaderTrailerFailure",
web: true,
unflatten: true,
assertWithGolden: true,
expectedCode: 1,
},
"call failure unary RPC with --enrich flag against to gRPC-Web server": {
commonFlags: "--web -r",
cmd: "call",
Expand Down
5 changes: 0 additions & 5 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ func TestMain(m *testing.M) {
cleanup2 := setEnv("XDG_CACHE_HOME", cacheDir)
defer cleanup2()

// TODO: Make registered types to be independent instead of ignoring conflicts.
// Need to make grpc-status-details-bin decoding to be used a passed registry.
cleanup3 := setEnv("GOLANG_PROTOBUF_REGISTRATION_CONFLICT", "ignore")
defer cleanup3()

goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("github.com/desertbit/timer.timerRoutine"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
"type": "type"
}
]
},
{
"@type": "type.googleapis.com/api.FailureDetail",
"code": "001"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ message: "internal error"
details:
{"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]}
{"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]}
{"@type": "type.googleapis.com/api.FailureDetail", "code": "001"}

Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ message: "internal error"
details:
{"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]}
{"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]}
{"@type": "type.googleapis.com/api.FailureDetail", "code": "001"}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
evans 0.10.5
evans 0.10.6

Usage: evans [global options ...] cli call [options ...] <method>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
evans 0.10.5
evans 0.10.6

Usage: evans [global options ...] cli desc [options ...] [symbol]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
evans 0.10.5
evans 0.10.6

Usage: evans [global options ...] cli list [options ...] [fully-qualified service/method name]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
evans 0.10.5
evans 0.10.6

Usage: evans [global options ...] cli

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
evans 0.10.5
evans 0.10.6

Usage: evans [global options ...] cli

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ message: "internal error"
details:
{"@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{"description": "description", "field": "field"}]}
{"@type": "type.googleapis.com/google.rpc.PreconditionFailure", "violations": [{"description": "description", "subject": "subject", "type": "type"}]}
{"@type": "type.googleapis.com/api.FailureDetail", "code": "001"}


4 changes: 0 additions & 4 deletions e2e/testdata/test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,3 @@ message UnaryHeaderRequest {}
message MapResponse {
map<string, Name> names = 1;
}

message FailureDetail {
string code = 1;
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/ktr0731/go-prompt v0.2.4
github.com/ktr0731/go-shellstring v0.1.3
github.com/ktr0731/go-updater v0.1.5
github.com/ktr0731/grpc-test v0.1.11
github.com/ktr0731/grpc-test v0.1.10
github.com/ktr0731/grpc-web-go-client v0.2.8
github.com/manifoldco/promptui v0.9.0
github.com/matryer/moq v0.2.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,8 @@ github.com/ktr0731/go-shellstring v0.1.3/go.mod h1:f0/XX0hsm6A02Es/UDQ9MGd3VqpCH
github.com/ktr0731/go-updater v0.1.5 h1:AiaQxJoI0OTGqvsJYdIITCOaEzQQOqU2MHKUwttVShY=
github.com/ktr0731/go-updater v0.1.5/go.mod h1:dsdOg7a9sj6ttcOU5ZxPCtKdm9WeB1hwcX/7oKgz9/0=
github.com/ktr0731/grpc-test v0.1.4/go.mod h1:v47616grayBYXQveGWxO3OwjLB3nEEnHsZuMTc73FM0=
github.com/ktr0731/grpc-test v0.1.11 h1:sXacyTdat8F1SWURSqECG1Cu546A5sYgI88XVexJ66Q=
github.com/ktr0731/grpc-test v0.1.11/go.mod h1:AP4+ZrqSzdDaUNhAsp2fye06MXO2fdYY6YQJifb588M=
github.com/ktr0731/grpc-test v0.1.10 h1:W+fdfNrcSY0+9aiIIx+CWpFcNjdcqysPQchDcuMk4Pk=
github.com/ktr0731/grpc-test v0.1.10/go.mod h1:AP4+ZrqSzdDaUNhAsp2fye06MXO2fdYY6YQJifb588M=
github.com/ktr0731/grpc-web-go-client v0.2.8 h1:nUf9p+YWirmFwmH0mwtAWhuXvzovc+/3C/eAY2Fshnk=
github.com/ktr0731/grpc-web-go-client v0.2.8/go.mod h1:1Iac8gFJvC/DRfZoGnFZsfEbEq/wQFK+2Ve1o3pHkCQ=
github.com/ktr0731/modfile v1.11.2/go.mod h1:LzNwnHJWHbuDh3BO17lIqzqDldXqGu1HCydWH3SinE0=
Expand Down
35 changes: 6 additions & 29 deletions idl/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import (
"github.com/ktr0731/evans/grpc/grpcreflection"
"github.com/ktr0731/evans/idl"
"github.com/pkg/errors"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/types/dynamicpb"
)

type spec struct {
Expand Down Expand Up @@ -143,7 +140,7 @@ func LoadFiles(importPaths []string, fnames []string) (idl.Spec, error) {
fileDescs = append(fileDescs, d.GetDependencies()...)
}

return newSpec(fileDescs)
return newSpec(fileDescs), nil
}

// LoadByReflection receives a gRPC reflection client, then tries to instantiate a new idl.Spec by using gRPC reflection.
Expand All @@ -152,10 +149,10 @@ func LoadByReflection(client grpcreflection.Client) (idl.Spec, error) {
if err != nil {
return nil, errors.Wrap(err, "failed to list packages by gRPC reflection")
}
return newSpec(fileDescs)
return newSpec(fileDescs), nil
}

func newSpec(fds []*desc.FileDescriptor) (idl.Spec, error) {
func newSpec(fds []*desc.FileDescriptor) idl.Spec {
var (
encounteredPkgs = make(map[string]interface{})
encounteredSvcs = make(map[string]interface{})
Expand All @@ -164,7 +161,6 @@ func newSpec(fds []*desc.FileDescriptor) (idl.Spec, error) {
rpcDescs = make(map[string][]*desc.MethodDescriptor)
msgDescs = make(map[string]*desc.MessageDescriptor)
)

for _, f := range fds {
if _, encountered := encounteredPkgs[f.GetPackage()]; !encountered {
pkgNames = append(pkgNames, f.GetPackage())
Expand All @@ -179,27 +175,8 @@ func newSpec(fds []*desc.FileDescriptor) (idl.Spec, error) {
rpcDescs[fqsn] = append(rpcDescs[fqsn], svc.GetMethods()...)
}

prfd, err := protodesc.NewFile(f.AsFileDescriptorProto(), protoregistry.GlobalFiles)
if err != nil {
return nil, errors.Wrapf(err, "failed to new protodesc")
}

if _, err := protoregistry.GlobalFiles.FindFileByPath(prfd.Path()); errors.Is(err, protoregistry.NotFound) {
if err := protoregistry.GlobalFiles.RegisterFile(prfd); err != nil {
return nil, err
}
}

for i := 0; i < prfd.Messages().Len(); i++ {
md := prfd.Messages().Get(i)
if _, err := protoregistry.GlobalTypes.FindMessageByName(md.FullName()); !errors.Is(err, protoregistry.NotFound) {
continue
}

mt := dynamicpb.NewMessageType(md)
if err := protoregistry.GlobalTypes.RegisterMessage(mt); err != nil {
return nil, errors.Wrapf(err, "failed to register message %s", mt.Descriptor().FullName())
}
for _, m := range f.GetMessageTypes() {
msgDescs[m.GetFullyQualifiedName()] = m
}
}

Expand All @@ -213,7 +190,7 @@ func newSpec(fds []*desc.FileDescriptor) (idl.Spec, error) {
svcDescs: svcDescs,
rpcDescs: rpcDescs,
msgDescs: msgDescs,
}, nil
}
}

// FullyQualifiedServiceName returns the fully-qualified service name.
Expand Down
2 changes: 1 addition & 1 deletion meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import version "github.com/hashicorp/go-version"
const AppName = "evans"

var (
Version = version.Must(version.NewSemver("0.10.5"))
Version = version.Must(version.NewSemver("0.10.6"))
)