Skip to content

Commit 4ee0a36

Browse files
erkasahidveljibeeme1mr
authored
fix(flipt): use default value from Flipt variant flag when available (#690)
Signed-off-by: Roman Dmytrenko <[email protected]> Co-authored-by: Sahid Velji <[email protected]> Co-authored-by: Michael Beemer <[email protected]>
1 parent 21f3de0 commit 4ee0a36

File tree

7 files changed

+247
-381
lines changed

7 files changed

+247
-381
lines changed

providers/flipt/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ import (
3434

3535
func main() {
3636
// http://localhost:8080 is the default Flipt address
37-
openfeature.SetProvider(flipt.NewProvider())
37+
err := openfeature.SetProviderAndWait(flipt.NewProvider())
38+
if err != nil {
39+
panic(err)
40+
}
3841

3942
client := openfeature.NewClient("my-app")
4043
value, err := client.BooleanValue(context.Background(), "v2_enabled", false, openfeature.NewEvaluationContext(
4144
42-
map[string]interface{}{
45+
map[string]any{
4346
"favorite_color": "blue",
4447
},
4548
))

providers/flipt/go.mod

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
module github.com/open-feature/go-sdk-contrib/providers/flipt
22

3-
go 1.22
3+
go 1.23.0
44

55
require (
6-
github.com/open-feature/go-sdk v1.13.1
7-
github.com/stretchr/testify v1.9.0
8-
go.flipt.io/flipt/rpc/flipt v1.45.0
9-
go.flipt.io/flipt/sdk/go v0.12.0
6+
github.com/open-feature/go-sdk v1.15.0
7+
github.com/stretchr/testify v1.10.0
8+
go.flipt.io/flipt/rpc/flipt v1.54.0
9+
go.flipt.io/flipt/sdk/go v0.13.0
1010
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0
11-
google.golang.org/grpc v1.67.1
12-
google.golang.org/protobuf v1.35.1
11+
google.golang.org/grpc v1.69.2
12+
google.golang.org/protobuf v1.36.1
1313
)
1414

1515
require (
1616
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
17-
github.com/go-logr/logr v1.4.2 // indirect
17+
github.com/go-logr/logr v1.4.3 // indirect
1818
github.com/go-logr/stdr v1.2.2 // indirect
19-
github.com/golang/protobuf v1.5.4 // indirect
20-
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
21-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
19+
github.com/google/gnostic-models v0.6.9 // indirect
20+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
2221
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
2322
github.com/stretchr/objx v0.5.2 // indirect
2423
go.flipt.io/flipt/errors v1.45.0 // indirect
25-
go.opentelemetry.io/otel v1.31.0 // indirect
26-
go.opentelemetry.io/otel/metric v1.31.0 // indirect
27-
go.opentelemetry.io/otel/trace v1.31.0 // indirect
28-
go.uber.org/multierr v1.11.0 // indirect
29-
go.uber.org/zap v1.27.0 // indirect
30-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
31-
golang.org/x/net v0.30.0 // indirect
32-
golang.org/x/sys v0.26.0 // indirect
33-
golang.org/x/text v0.19.0 // indirect
34-
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
35-
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
36-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
24+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
25+
go.opentelemetry.io/otel v1.33.0 // indirect
26+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
27+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
28+
go.uber.org/mock v0.5.2 // indirect
29+
golang.org/x/net v0.33.0 // indirect
30+
golang.org/x/sys v0.28.0 // indirect
31+
golang.org/x/text v0.25.0 // indirect
32+
google.golang.org/genproto/googleapis/api v0.0.0-20241230172942-26aa7a208def // indirect
33+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def // indirect
3734
gopkg.in/yaml.v3 v3.0.1 // indirect
3835
)

providers/flipt/go.sum

Lines changed: 46 additions & 113 deletions
Large diffs are not rendered by default.

providers/flipt/pkg/provider/example_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ import (
88
)
99

1010
func Example() {
11-
openfeature.SetProvider(flipt.NewProvider(
11+
err := openfeature.SetProviderAndWait(flipt.NewProvider(
1212
flipt.WithAddress("localhost:9000"),
1313
))
14+
if err != nil {
15+
panic(err)
16+
}
1417

1518
client := openfeature.NewClient("my-app")
1619
value, err := client.BooleanValue(
17-
context.Background(), "v2_enabled", false, openfeature.NewEvaluationContext("[email protected]", map[string]interface{}{
20+
context.TODO(), "v2_enabled", false, openfeature.NewEvaluationContext("[email protected]", map[string]any{
1821
"favorite_color": "blue",
1922
}),
2023
)
21-
2224
if err != nil {
2325
panic(err)
2426
}

0 commit comments

Comments
 (0)