From dd2f60135c35bcfae1dbcf97609a36e7dc6dc0cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 10:26:55 -0400 Subject: [PATCH] Bump github.com/jhump/protoreflect from 1.13.0 to 1.14.0 (#343) * Bump github.com/jhump/protoreflect from 1.13.0 to 1.14.0 Bumps [github.com/jhump/protoreflect](https://github.com/jhump/protoreflect) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/jhump/protoreflect/releases) - [Commits](https://github.com/jhump/protoreflect/compare/v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/jhump/protoreflect dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * fix ci * what can we even build on? * stop testing old things Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Scott Blum --- .circleci/config.yml | 27 +++++++------------------ Makefile | 14 +++++-------- cmd/grpcurl/go1_10.go | 1 + cmd/grpcurl/go1_9.go | 1 + cmd/grpcurl/grpcurl.go | 8 ++++---- cmd/grpcurl/unix.go | 1 + format.go | 10 +++++++++ go.mod | 2 +- go.sum | 4 ++-- grpcurl.go | 6 +++--- grpcurl_test.go | 4 ++-- internal/testing/cmd/testserver/unix.go | 1 + tls_settings_test.go | 18 ++++++++--------- 13 files changed, 47 insertions(+), 50 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4501d21..b12915b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,5 @@ shared_configs: simple_job_steps: &simple_job_steps - - checkout - - run: - name: Run tests - command: | - make deps test - full_job_steps: &full_job_steps - checkout - run: name: Run tests @@ -15,18 +9,6 @@ shared_configs: # Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference version: 2.1 jobs: - build-1-15: - working_directory: ~/repo - docker: - - image: cimg/go:1.15 - steps: *simple_job_steps - - build-1-16: - working_directory: ~/repo - docker: - - image: cimg/go:1.16 - steps: *full_job_steps - build-1-17: working_directory: ~/repo docker: @@ -39,10 +21,15 @@ jobs: - image: cimg/go:1.18 steps: *simple_job_steps + build-1-19: + working_directory: ~/repo + docker: + - image: cimg/go:1.19 + steps: *simple_job_steps + workflows: pr-build-test: jobs: - - build-1-15 - - build-1-16 - build-1-17 - build-1-18 + - build-1-19 diff --git a/Makefile b/Makefile index 3de66ee..0a5ef40 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,9 @@ checkgofmt: vet: go vet ./... -# This all works fine with Go modules, but without modules, -# CI is just getting latest master for dependencies like grpc. .PHONY: staticcheck staticcheck: - @go install honnef.co/go/tools/cmd/staticcheck@v0.0.1-2020.1.4 + @go install honnef.co/go/tools/cmd/staticcheck@v0.3.3 staticcheck ./... .PHONY: ineffassign @@ -56,21 +54,19 @@ ineffassign: .PHONY: predeclared predeclared: - @go install github.com/nishanths/predeclared@86fad755b4d3 - predeclared . + @go install github.com/nishanths/predeclared@5f2f810c9ae6 + predeclared ./... # Intentionally omitted from CI, but target here for ad-hoc reports. .PHONY: golint golint: - # TODO: pin version - @go install golang.org/x/lint/golint@latest + @go install golang.org/x/lint/golint@v0.0.0-20210508222113-6edffad5e616 golint -min_confidence 0.9 -set_exit_status ./... # Intentionally omitted from CI, but target here for ad-hoc reports. .PHONY: errcheck errcheck: - # TODO: pin version - @go install github.com/kisielk/errcheck@latest + @go install github.com/kisielk/errcheck@v1.2.0 errcheck ./... .PHONY: test diff --git a/cmd/grpcurl/go1_10.go b/cmd/grpcurl/go1_10.go index ff96b0e..815e672 100644 --- a/cmd/grpcurl/go1_10.go +++ b/cmd/grpcurl/go1_10.go @@ -1,3 +1,4 @@ +//go:build go1.10 // +build go1.10 package main diff --git a/cmd/grpcurl/go1_9.go b/cmd/grpcurl/go1_9.go index 8a2a30d..0b2774e 100644 --- a/cmd/grpcurl/go1_9.go +++ b/cmd/grpcurl/go1_9.go @@ -1,3 +1,4 @@ +//go:build !go1.10 // +build !go1.10 package main diff --git a/cmd/grpcurl/grpcurl.go b/cmd/grpcurl/grpcurl.go index bda5e3c..a363800 100644 --- a/cmd/grpcurl/grpcurl.go +++ b/cmd/grpcurl/grpcurl.go @@ -38,9 +38,9 @@ import ( // the response status codes emitted use an offest of 64 const statusCodeOffset = 64 -const no_version = "dev build " +const noVersion = "dev build " -var version = no_version +var version = noVersion var ( exit = os.Exit @@ -445,7 +445,7 @@ func main() { } grpcurlUA := "grpcurl/" + version - if version == no_version { + if version == noVersion { grpcurlUA = "grpcurl/dev-build (no version set)" } if *userAgent != "" { @@ -508,7 +508,7 @@ func main() { md := grpcurl.MetadataFromHeaders(append(addlHeaders, reflHeaders...)) refCtx := metadata.NewOutgoingContext(ctx, md) cc = dial() - refClient = grpcreflect.NewClient(refCtx, reflectpb.NewServerReflectionClient(cc)) + refClient = grpcreflect.NewClientV1Alpha(refCtx, reflectpb.NewServerReflectionClient(cc)) reflSource := grpcurl.DescriptorSourceFromServer(ctx, refClient) if fileSource != nil { descSource = compositeSource{reflSource, fileSource} diff --git a/cmd/grpcurl/unix.go b/cmd/grpcurl/unix.go index e79a28a..cae4bed 100644 --- a/cmd/grpcurl/unix.go +++ b/cmd/grpcurl/unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows // +build darwin dragonfly freebsd linux netbsd openbsd solaris windows package main diff --git a/format.go b/format.go index 20de407..bec125d 100644 --- a/format.go +++ b/format.go @@ -197,10 +197,20 @@ func (tf *textFormatter) format(m proto.Message) (string, error) { return str, nil } +// Format of request data. The allowed values are 'json' or 'text'. type Format string const ( + // FormatJSON specifies input data in JSON format. Multiple request values + // may be concatenated (messages with a JSON representation other than + // object must be separated by whitespace, such as a newline) FormatJSON = Format("json") + + // FormatText specifies input data must be in the protobuf text format. + // Multiple request values must be separated by the "record separator" + // ASCII character: 0x1E. The stream should not end in a record separator. + // If it does, it will be interpreted as a final, blank message after the + // separator. FormatText = Format("text") ) diff --git a/go.mod b/go.mod index c614816..8ac6102 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.56.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/protobuf v1.5.2 - github.com/jhump/protoreflect v1.13.0 + github.com/jhump/protoreflect v1.14.0 golang.org/x/text v0.3.7 // indirect google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 diff --git a/go.sum b/go.sum index 7c1ca9e..bec8ca3 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,8 @@ github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSl github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI= github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ= github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= -github.com/jhump/protoreflect v1.13.0 h1:zrrZqa7JAc2YGgPSzZZkmUXJ5G6NRPdxOg/9t7ISImA= -github.com/jhump/protoreflect v1.13.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= +github.com/jhump/protoreflect v1.14.0 h1:MBbQK392K3u8NTLbKOCIi3XdI+y+c6yt5oMq0X3xviw= +github.com/jhump/protoreflect v1.14.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= diff --git a/grpcurl.go b/grpcurl.go index f36fc9e..e98bf85 100644 --- a/grpcurl.go +++ b/grpcurl.go @@ -407,9 +407,9 @@ func makeTemplate(md *desc.MessageDescriptor, path []*desc.MessageDescriptor) pr case "google.protobuf.Any": // empty type URL is not allowed by JSON representation // so we must give it a dummy type - var any anypb.Any - _ = anypb.MarshalFrom(&any, &emptypb.Empty{}, protov2.MarshalOptions{}) - return &any + var anyVal anypb.Any + _ = anypb.MarshalFrom(&anyVal, &emptypb.Empty{}, protov2.MarshalOptions{}) + return &anyVal case "google.protobuf.Value": // unset kind is not allowed by JSON representation // so we must give it something diff --git a/grpcurl_test.go b/grpcurl_test.go index 25b4276..bc020c2 100644 --- a/grpcurl_test.go +++ b/grpcurl_test.go @@ -82,7 +82,7 @@ func TestMain(m *testing.M) { panic(err) } defer ccReflect.Close() - refClient := grpcreflect.NewClient(context.Background(), reflectpb.NewServerReflectionClient(ccReflect)) + refClient := grpcreflect.NewClientV1Alpha(context.Background(), reflectpb.NewServerReflectionClient(ccReflect)) defer refClient.Reset() sourceReflect = DescriptorSourceFromServer(context.Background(), refClient) @@ -118,7 +118,7 @@ func TestMain(m *testing.M) { } func TestServerDoesNotSupportReflection(t *testing.T) { - refClient := grpcreflect.NewClient(context.Background(), reflectpb.NewServerReflectionClient(ccNoReflect)) + refClient := grpcreflect.NewClientV1Alpha(context.Background(), reflectpb.NewServerReflectionClient(ccNoReflect)) defer refClient.Reset() refSource := DescriptorSourceFromServer(context.Background(), refClient) diff --git a/internal/testing/cmd/testserver/unix.go b/internal/testing/cmd/testserver/unix.go index 9dfa5fa..8fc45dc 100644 --- a/internal/testing/cmd/testserver/unix.go +++ b/internal/testing/cmd/testserver/unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package main diff --git a/tls_settings_test.go b/tls_settings_test.go index bd96482..cef3adf 100644 --- a/tls_settings_test.go +++ b/tls_settings_test.go @@ -170,8 +170,8 @@ func TestBrokenTLS_ServerPlainText(t *testing.T) { e, err := createTestServerAndClient(nil, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "first record does not look like a TLS handshake") { t.Fatalf("expecting TLS handshake failure, got: %v", err) @@ -190,8 +190,8 @@ func TestBrokenTLS_ServerUsesWrongCert(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "certificate is valid for") { t.Fatalf("expecting TLS certificate error, got: %v", err) @@ -210,8 +210,8 @@ func TestBrokenTLS_ClientHasExpiredCert(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "bad certificate") { t.Fatalf("expecting TLS certificate error, got: %v", err) @@ -230,8 +230,8 @@ func TestBrokenTLS_ServerHasExpiredCert(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "certificate has expired or is not yet valid") { t.Fatalf("expecting TLS certificate expired, got: %v", err) @@ -250,8 +250,8 @@ func TestBrokenTLS_ClientNotTrusted(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "bad certificate") { t.Fatalf("expecting TLS certificate error, got: %v", err) @@ -270,10 +270,10 @@ func TestBrokenTLS_ServerNotTrusted(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } - if !strings.Contains(err.Error(), "certificate signed by unknown authority") { + if !strings.Contains(err.Error(), "certificate") { t.Fatalf("expecting TLS certificate error, got: %v", err) } } @@ -290,8 +290,8 @@ func TestBrokenTLS_RequireClientCertButNonePresented(t *testing.T) { e, err := createTestServerAndClient(serverCreds, clientCreds) if err == nil { - t.Fatal("expecting TLS failure setting up server and client") e.Close() + t.Fatal("expecting TLS failure setting up server and client") } if !strings.Contains(err.Error(), "bad certificate") { t.Fatalf("expecting TLS certificate error, got: %v", err) @@ -349,7 +349,7 @@ type testEnv struct { cc *grpc.ClientConn } -func (e testEnv) Close() { +func (e *testEnv) Close() { if e.cc != nil { e.cc.Close() e.cc = nil