Skip to content

Commit be4cccb

Browse files
authored
Update tools (#86)
This updates the buf yamls to v2, tools version, regenerates and fixes lint issue. --------- Signed-off-by: Edward McFarlane <[email protected]>
1 parent c885b55 commit be4cccb

File tree

20 files changed

+214
-342
lines changed

20 files changed

+214
-342
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2022 The Connect Authors
189+
Copyright 2022-2025 The Connect Authors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ MAKEFLAGS += --no-print-directory
99
BIN=$(abspath .tmp/bin)
1010
export PATH := $(BIN):$(PATH)
1111
export GOBIN := $(abspath $(BIN))
12-
COPYRIGHT_YEARS := 2022-2024
12+
COPYRIGHT_YEARS := 2022-2025
1313
LICENSE_IGNORE := --ignore /testdata/ --ignore internal/proto/connectext/
1414

1515
.PHONY: help
@@ -71,15 +71,15 @@ checkgenerate:
7171

7272
$(BIN)/buf: Makefile
7373
@mkdir -p $(@D)
74-
go install github.com/bufbuild/buf/cmd/buf@v1.29.0
74+
go install github.com/bufbuild/buf/cmd/buf@v1.50.0
7575

7676
$(BIN)/license-header: Makefile
7777
@mkdir -p $(@D)
78-
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.29.0
78+
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v1.50.0
7979

8080
$(BIN)/golangci-lint: Makefile
8181
@mkdir -p $(@D)
82-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
82+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5
8383

8484
$(BIN)/protoc-gen-go: Makefile
8585
@mkdir -p $(@D)

buf.gen.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
version: v1
1+
version: v2
22
managed:
33
enabled: true
4-
go_package_prefix:
5-
default: connectrpc.com/grpcreflect/internal/gen/go
4+
override:
5+
- file_option: go_package_prefix
6+
value: connectrpc.com/grpcreflect/internal/gen/go
67
plugins:
7-
- plugin: go
8+
- local: protoc-gen-go
89
out: internal/gen/go
910
opt: paths=source_relative

buf.work.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

buf.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: v2
2+
modules:
3+
- path: internal/proto
4+
lint:
5+
use:
6+
- STANDARD
7+
except:
8+
- FIELD_NOT_REQUIRED
9+
- PACKAGE_NO_IMPORT_CYCLE
10+
ignore:
11+
- internal/proto/connectext/grpc/health/v1/health.proto
12+
- internal/proto/connectext/grpc/reflection/v1/reflection.proto
13+
- internal/proto/connectext/grpc/status/v1/status.proto
14+
disallow_comment_ignores: true
15+
breaking:
16+
use:
17+
- WIRE_JSON
18+
except:
19+
- FIELD_SAME_DEFAULT
20+

client.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2024 The Connect Authors
1+
// Copyright 2022-2025 The Connect Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -366,7 +366,11 @@ func (cs *ClientStream) send(req *reflectionv1.ServerReflectionRequest) (*reflec
366366
return nil, &streamError{err: err}
367367
}
368368
if errResp := resp.GetErrorResponse(); errResp != nil {
369-
return nil, connect.NewWireError(connect.Code(errResp.ErrorCode), errors.New(errResp.ErrorMessage))
369+
code := connect.CodeInternal
370+
if errResp.ErrorCode > 0 {
371+
code = connect.Code(errResp.ErrorCode)
372+
}
373+
return nil, connect.NewWireError(code, errors.New(errResp.ErrorMessage))
370374
}
371375
return resp, nil
372376
}
@@ -439,7 +443,10 @@ func respType(msg *reflectionv1.ServerReflectionResponse) string {
439443
case *reflectionv1.ServerReflectionResponse_ListServicesResponse:
440444
return "list_services_response"
441445
case *reflectionv1.ServerReflectionResponse_ErrorResponse:
442-
return fmt.Sprintf("error_response: %v", connect.Code(resp.ErrorResponse.ErrorCode))
446+
if errorCode := resp.ErrorResponse.ErrorCode; errorCode > 0 {
447+
return fmt.Sprintf("error_response: %v", connect.Code(errorCode))
448+
}
449+
return fmt.Sprintf("error_response: %d", resp.ErrorResponse.ErrorCode)
443450
case nil:
444451
return "empty?"
445452
default:

client_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2024 The Connect Authors
1+
// Copyright 2022-2025 The Connect Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2024 The Connect Authors
1+
// Copyright 2022-2025 The Connect Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module connectrpc.com/grpcreflect
33
go 1.21
44

55
require (
6-
connectrpc.com/connect v1.11.0
7-
github.com/google/go-cmp v0.5.9
8-
google.golang.org/protobuf v1.33.0
6+
connectrpc.com/connect v1.18.1
7+
github.com/google/go-cmp v0.7.0
8+
google.golang.org/protobuf v1.36.5
99
)

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
connectrpc.com/connect v1.11.0 h1:Av2KQXxSaX4vjqhf5Cl01SX4dqYADQ38eBtr84JSUBk=
22
connectrpc.com/connect v1.11.0/go.mod h1:3AGaO6RRGMx5IKFfqbe3hvK1NqLosFNP2BxDYTPmNPo=
3+
connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw=
4+
connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8=
35
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
46
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
8+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
59
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
610
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
11+
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
12+
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

0 commit comments

Comments
 (0)