Skip to content

Commit 7dd5b2b

Browse files
authored
refactor: migrate to connectrpc/connect-go (#990)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> Migrate from bufbuild/connect-go to connectrpc/connect-go. ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Closes #790. ### Notes <!-- any additional notes for this PR --> ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> I'll also create a PR in https://github.com/open-feature/go-sdk-contrib to migrate to connectrpc/connect-go for the flagd provider. ### How to test <!-- if applicable, add testing instructions under this section --> Signed-off-by: Craig Pastro <craig.pastro@gmail.com>
1 parent e9347cc commit 7dd5b2b

File tree

14 files changed

+33
-407
lines changed

14 files changed

+33
-407
lines changed

core/go.mod

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module github.com/open-feature/flagd/core
33
go 1.20
44

55
require (
6-
buf.build/gen/go/open-feature/flagd/bufbuild/connect-go v1.9.0-20230720212818-3675556880a1.1
6+
buf.build/gen/go/open-feature/flagd/connectrpc/go v1.12.0-20231031123731-ac2ec0f39838.1
77
buf.build/gen/go/open-feature/flagd/grpc/go v1.3.0-20230710190440-2333a9579c1a.1
8-
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.31.0-20230720212818-3675556880a1.1
9-
github.com/bufbuild/connect-go v1.10.0
10-
github.com/bufbuild/connect-opentelemetry-go v0.4.0
8+
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.31.0-20231031123731-ac2ec0f39838.2
9+
connectrpc.com/connect v1.12.0
10+
connectrpc.com/otelconnect v0.6.0
1111
github.com/diegoholiveira/jsonlogic/v3 v3.3.2
1212
github.com/fsnotify/fsnotify v1.7.0
1313
github.com/golang/mock v1.6.0
@@ -85,11 +85,9 @@ require (
8585
github.com/prometheus/client_model v0.5.0 // indirect
8686
github.com/prometheus/common v0.44.0 // indirect
8787
github.com/prometheus/procfs v0.11.1 // indirect
88-
github.com/rogpeppe/go-internal v1.11.0 // indirect
8988
github.com/spf13/pflag v1.0.5 // indirect
9089
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
9190
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
92-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 // indirect
9391
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
9492
go.uber.org/multierr v1.11.0 // indirect
9593
golang.org/x/oauth2 v0.11.0 // indirect

core/go.sum

Lines changed: 13 additions & 172 deletions
Large diffs are not rendered by default.

core/pkg/service/flag-evaluation/connect_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"sync"
1212
"time"
1313

14-
schemaConnectV1 "buf.build/gen/go/open-feature/flagd/bufbuild/connect-go/schema/v1/schemav1connect"
14+
schemaConnectV1 "buf.build/gen/go/open-feature/flagd/connectrpc/go/schema/v1/schemav1connect"
1515
"github.com/open-feature/flagd/core/pkg/eval"
1616
"github.com/open-feature/flagd/core/pkg/logger"
1717
"github.com/open-feature/flagd/core/pkg/service"

core/pkg/service/flag-evaluation/flag_evaluator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77

88
schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
9-
"github.com/bufbuild/connect-go"
9+
"connectrpc.com/connect"
1010
"github.com/open-feature/flagd/core/pkg/eval"
1111
"github.com/open-feature/flagd/core/pkg/logger"
1212
"github.com/open-feature/flagd/core/pkg/model"

core/pkg/service/flag-evaluation/flag_evaluator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
9-
"github.com/bufbuild/connect-go"
9+
"connectrpc.com/connect"
1010
"github.com/golang/mock/gomock"
1111
"github.com/open-feature/flagd/core/pkg/eval"
1212
mock "github.com/open-feature/flagd/core/pkg/eval/mock"

core/pkg/service/flag-evaluation/flag_evaluator_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55

66
schemaV1 "buf.build/gen/go/open-feature/flagd/protocolbuffers/go/schema/v1"
7-
"github.com/bufbuild/connect-go"
7+
"connectrpc.com/connect"
88
"google.golang.org/protobuf/types/known/structpb"
99
)
1010

core/pkg/service/flag-evaluation/json_codec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import (
77
"errors"
88
"fmt"
99

10-
"github.com/bufbuild/connect-go"
10+
"connectrpc.com/connect"
1111
"google.golang.org/protobuf/encoding/protojson"
1212
"google.golang.org/protobuf/proto"
1313
"google.golang.org/protobuf/runtime/protoiface"
1414
)
1515

1616
// WithJSON customizes a connect-go Client or Handler's JSON by exposing MarshalOptions, and UnmarshalOptions
17-
// See: https://github.com/bufbuild/connect-go/blob/main/codec.go
17+
// See: https://github.com/connectrpc/connect-go/blob/main/codec.go
1818
// Heavily inspired by https://github.com/akshayjshah/connectproto
1919
func WithJSON(marshal protojson.MarshalOptions, unmarshal protojson.UnmarshalOptions) connect.Option {
2020
return connect.WithOptions(

core/pkg/service/iservice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package service
33
import (
44
"context"
55

6-
"github.com/bufbuild/connect-go"
6+
"connectrpc.com/connect"
77
)
88

99
type NotificationType string

core/pkg/service/middleware/metrics/http_metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (w *responseWriterInterceptor) Hijack() (net.Conn, *bufio.ReadWriter, error
157157
}
158158

159159
// Flush need to exist to be compatible with connect-go.
160-
// See github.com/bufbuild/connect-go@v1.5.2/protocol_connect.go @ line 135
160+
// See https://github.com/connectrpc/connect-go/blob/main/protocol_connect.go
161161
func (w *responseWriterInterceptor) Flush() {
162162
f, ok := w.ResponseWriter.(http.Flusher)
163163
if !ok {

core/pkg/telemetry/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/bufbuild/connect-go"
9-
otelconnect "github.com/bufbuild/connect-opentelemetry-go"
8+
"connectrpc.com/connect"
9+
"connectrpc.com/otelconnect"
1010
"github.com/open-feature/flagd/core/pkg/logger"
1111
"go.opentelemetry.io/otel"
1212
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"

flagd-proxy/go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,13 @@ require (
6464
github.com/prometheus/common v0.44.0 // indirect
6565
github.com/prometheus/procfs v0.11.1 // indirect
6666
github.com/robfig/cron v1.2.0 // indirect
67-
github.com/rogpeppe/go-internal v1.11.0 // indirect
6867
github.com/rs/cors v1.10.1 // indirect
6968
github.com/rs/xid v1.5.0 // indirect
7069
github.com/sagikazarmark/locafero v0.3.0 // indirect
7170
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
7271
github.com/sourcegraph/conc v0.3.0 // indirect
7372
github.com/spf13/afero v1.10.0 // indirect
7473
github.com/spf13/cast v1.5.1 // indirect
75-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
7674
github.com/spf13/pflag v1.0.5 // indirect
7775
github.com/subosito/gotenv v1.6.0 // indirect
7876
github.com/twmb/murmur3 v1.1.8 // indirect

0 commit comments

Comments
 (0)