Skip to content

Commit

Permalink
address PR feedback from @bufdev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Bourque committed Apr 25, 2024
1 parent 69c2395 commit e1d3c1d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ test:
@go test ${TEST_OPTS} ${TEST_RACE} ./...

BUILD_TIME_TOOLS =\
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway\
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
google.golang.org/protobuf/cmd/protoc-gen-go \
connectrpc.com/connect/cmd/protoc-gen-connect-go

.PHONY: install-tools
Expand Down
6 changes: 3 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ managed:
plugins:
- name: go
opt: paths=source_relative
out: ./perseusapi
out: perseusapi
- name: connect-go
opt:
- paths=source_relative
out: ./perseusapi
out: perseusapi
- name: openapiv2
opt:
- allow_repeated_fields_in_body=true
out: ./docs
out: docs

6 changes: 4 additions & 2 deletions client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ func (conf *clientConfig) getClient() (client perseusapiconnect.PerseusServiceCl
opts = append(opts, httplb.WithTLSConfig(&tlsc, 0))
}

httpc := httplb.NewClient(opts...)
// we include WithGRPC() so that the CLI can hit an existing gRPC-based server instance
// - this may be removed at some point in the future
cc := perseusapiconnect.NewPerseusServiceClient(httpc, conf.serverAddr, connect.WithGRPC())
cc := perseusapiconnect.NewPerseusServiceClient(
httplb.NewClient(opts...),
conf.serverAddr,
connect.WithGRPC())
return cc
}
6 changes: 1 addition & 5 deletions findpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ func runFindPathsCommand(cmd *cobra.Command, args []string) (err error) {
for p := range pf.findPathsBetween(ctx, from, to) {
if p.err != nil {
// context cancellation is not a failure
if errors.Is(p.err, context.Canceled) {
return nil
}
var ce *connect.Error
if errors.As(p.err, &ce) && ce.Code() == connect.CodeCanceled {
if errors.Is(p.err, context.Canceled) || connect.CodeOf(err) == connect.CodeCanceled {
return nil
}
return p.err
Expand Down

0 comments on commit e1d3c1d

Please sign in to comment.