diff --git a/core/go.mod b/core/go.mod index 7c2b871a7..6d75bda8b 100644 --- a/core/go.mod +++ b/core/go.mod @@ -5,8 +5,8 @@ go 1.22.0 toolchain go1.22.7 require ( - buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 - buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 + buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 + buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 connectrpc.com/connect v1.17.0 connectrpc.com/otelconnect v0.7.1 github.com/diegoholiveira/jsonlogic/v3 v3.5.3 diff --git a/core/go.sum b/core/go.sum index b55c0e80a..c355c2f89 100644 --- a/core/go.sum +++ b/core/go.sum @@ -1,7 +1,11 @@ buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 h1:i30n9d9zBIbLOzwsH82w7g6EOv6xtPN/byveEH9B9KQ= buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1/go.mod h1:aqQ1tVIXcuAslNu5a3xTSE9qvYEazL6pCZ/VLU7j1hc= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 h1:18ZObecoJfRbNQDeuW0PoBR829Mw8FrPrmWIbbaA5hs= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1/go.mod h1:WA65xyBj+VxPfJ3a+EqdZtWGeNdwqiaQO1sriHaNL1Y= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 h1:f0Zk6mcwiIZNs5pRkK8hfaE1NynStc2Z4hEnripAKTo= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2/go.mod h1:Y4p3/wjytMsn6a+N0geaRNEilEqj2pS3qrPqRFO5cY0= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 h1:z/+GDTJLJJjpTon7CK/pxrbwwtK7YmllO7jSTvGh0QA= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2/go.mod h1:OA7of1NYh+7uttnef5AxaNjL7y1AdjLpZ4DD1a4vuZg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= diff --git a/flagd-proxy/go.mod b/flagd-proxy/go.mod index b403a3753..e22c5760c 100644 --- a/flagd-proxy/go.mod +++ b/flagd-proxy/go.mod @@ -5,8 +5,8 @@ go 1.22.0 toolchain go1.22.7 require ( - buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 - buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 + buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 + buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 github.com/dimiro1/banner v1.1.0 github.com/mattn/go-colorable v0.1.13 github.com/open-feature/flagd/core v0.10.2 diff --git a/flagd-proxy/go.sum b/flagd-proxy/go.sum index f0ac45a12..265e9eb65 100644 --- a/flagd-proxy/go.sum +++ b/flagd-proxy/go.sum @@ -1,7 +1,11 @@ buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 h1:i30n9d9zBIbLOzwsH82w7g6EOv6xtPN/byveEH9B9KQ= buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1/go.mod h1:aqQ1tVIXcuAslNu5a3xTSE9qvYEazL6pCZ/VLU7j1hc= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 h1:18ZObecoJfRbNQDeuW0PoBR829Mw8FrPrmWIbbaA5hs= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1/go.mod h1:WA65xyBj+VxPfJ3a+EqdZtWGeNdwqiaQO1sriHaNL1Y= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 h1:f0Zk6mcwiIZNs5pRkK8hfaE1NynStc2Z4hEnripAKTo= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2/go.mod h1:Y4p3/wjytMsn6a+N0geaRNEilEqj2pS3qrPqRFO5cY0= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 h1:z/+GDTJLJJjpTon7CK/pxrbwwtK7YmllO7jSTvGh0QA= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2/go.mod h1:OA7of1NYh+7uttnef5AxaNjL7y1AdjLpZ4DD1a4vuZg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= diff --git a/flagd-proxy/pkg/service/handler.go b/flagd-proxy/pkg/service/handler.go index fa2abc6d5..fc3bcf5ab 100644 --- a/flagd-proxy/pkg/service/handler.go +++ b/flagd-proxy/pkg/service/handler.go @@ -72,6 +72,7 @@ type oldHandler struct { ctx context.Context } +//nolint:staticcheck func (l *oldHandler) FetchAllFlags(ctx context.Context, req *syncv1.FetchAllFlagsRequest) ( *syncv1.FetchAllFlagsResponse, error, @@ -86,6 +87,7 @@ func (l *oldHandler) FetchAllFlags(ctx context.Context, req *syncv1.FetchAllFlag }, nil } +//nolint:staticcheck func (l *oldHandler) SyncFlags( req *syncv1.SyncFlagsRequest, stream rpc.FlagSyncService_SyncFlagsServer, @@ -114,6 +116,7 @@ func (l *oldHandler) SyncFlags( } } +//nolint:staticcheck func dataSyncToGrpcState(s sync.DataSync) syncv1.SyncState { return syncv1.SyncState(s.Type + 1) } diff --git a/flagd-proxy/tests/loadtest/pkg/watcher/watcher.go b/flagd-proxy/tests/loadtest/pkg/watcher/watcher.go index cba1f2846..91449b6e7 100644 --- a/flagd-proxy/tests/loadtest/pkg/watcher/watcher.go +++ b/flagd-proxy/tests/loadtest/pkg/watcher/watcher.go @@ -15,7 +15,8 @@ const ( ) type Watcher struct { - client syncv1grpc.FlagSyncServiceClient + client syncv1grpc.FlagSyncServiceClient + //nolint:staticcheck Stream chan syncv1Types.SyncState Ready chan struct{} targetFile string @@ -23,6 +24,7 @@ type Watcher struct { func NewWatcher(client syncv1grpc.FlagSyncServiceClient, target string) *Watcher { return &Watcher{ + //nolint:staticcheck Stream: make(chan syncv1Types.SyncState, 1), client: client, Ready: make(chan struct{}), @@ -30,6 +32,7 @@ func NewWatcher(client syncv1grpc.FlagSyncServiceClient, target string) *Watcher } } +//nolint:staticcheck func (w *Watcher) StartWatcher(ctx context.Context) error { stream, err := w.client.SyncFlags(ctx, &syncv1Types.SyncFlagsRequest{ Selector: fmt.Sprintf("file:%s", w.targetFile), diff --git a/flagd/go.mod b/flagd/go.mod index 0955585f6..5dd301011 100644 --- a/flagd/go.mod +++ b/flagd/go.mod @@ -6,8 +6,8 @@ toolchain go1.22.7 require ( buf.build/gen/go/open-feature/flagd/connectrpc/go v1.16.2-20240906125204-0a6a901b42e8.1 - buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 - buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 + buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 + buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 connectrpc.com/connect v1.17.0 github.com/dimiro1/banner v1.1.0 github.com/gorilla/mux v1.8.1 diff --git a/flagd/go.sum b/flagd/go.sum index e221fe97c..b06026012 100644 --- a/flagd/go.sum +++ b/flagd/go.sum @@ -2,8 +2,12 @@ buf.build/gen/go/open-feature/flagd/connectrpc/go v1.16.2-20240906125204-0a6a901 buf.build/gen/go/open-feature/flagd/connectrpc/go v1.16.2-20240906125204-0a6a901b42e8.1/go.mod h1:1ZCmwepvRLrOEOv9Hto8qUGE+S0dhHqiCbDZHsG8jGk= buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1 h1:i30n9d9zBIbLOzwsH82w7g6EOv6xtPN/byveEH9B9KQ= buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1/go.mod h1:aqQ1tVIXcuAslNu5a3xTSE9qvYEazL6pCZ/VLU7j1hc= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1 h1:18ZObecoJfRbNQDeuW0PoBR829Mw8FrPrmWIbbaA5hs= +buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1/go.mod h1:WA65xyBj+VxPfJ3a+EqdZtWGeNdwqiaQO1sriHaNL1Y= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2 h1:f0Zk6mcwiIZNs5pRkK8hfaE1NynStc2Z4hEnripAKTo= buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240215170432-1e611e2999cc.2/go.mod h1:Y4p3/wjytMsn6a+N0geaRNEilEqj2pS3qrPqRFO5cY0= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2 h1:z/+GDTJLJJjpTon7CK/pxrbwwtK7YmllO7jSTvGh0QA= +buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2/go.mod h1:OA7of1NYh+7uttnef5AxaNjL7y1AdjLpZ4DD1a4vuZg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= diff --git a/flagd/pkg/service/flag-evaluation/flag_evaluator.go b/flagd/pkg/service/flag-evaluation/flag_evaluator.go index b05929bc3..29b4c229e 100644 --- a/flagd/pkg/service/flag-evaluation/flag_evaluator.go +++ b/flagd/pkg/service/flag-evaluation/flag_evaluator.go @@ -1,5 +1,3 @@ -//lint:file-ignore SA4003 old proto is deprecated but we want to serve it for a while - package service import ( @@ -55,7 +53,7 @@ func NewOldFlagEvaluationService(log *logger.Logger, return svc } -// nolint:dupl,funlen +// nolint:dupl,funlen,staticcheck func (s *OldFlagEvaluationService) ResolveAll( ctx context.Context, req *connect.Request[schemaV1.ResolveAllRequest], @@ -126,7 +124,7 @@ func (s *OldFlagEvaluationService) ResolveAll( return connect.NewResponse(res), nil } -// nolint:dupl +// nolint:dupl,staticcheck func (s *OldFlagEvaluationService) EventStream( ctx context.Context, req *connect.Request[schemaV1.EventStreamRequest], @@ -166,6 +164,7 @@ func (s *OldFlagEvaluationService) EventStream( } } +//nolint:staticcheck func (s *OldFlagEvaluationService) ResolveBoolean( ctx context.Context, req *connect.Request[schemaV1.ResolveBooleanRequest], @@ -190,6 +189,7 @@ func (s *OldFlagEvaluationService) ResolveBoolean( return res, err } +//nolint:staticcheck func (s *OldFlagEvaluationService) ResolveString( ctx context.Context, req *connect.Request[schemaV1.ResolveStringRequest], @@ -215,6 +215,7 @@ func (s *OldFlagEvaluationService) ResolveString( return res, err } +//nolint:staticcheck func (s *OldFlagEvaluationService) ResolveInt( ctx context.Context, req *connect.Request[schemaV1.ResolveIntRequest], @@ -240,6 +241,7 @@ func (s *OldFlagEvaluationService) ResolveInt( return res, err } +//nolint:staticcheck func (s *OldFlagEvaluationService) ResolveFloat( ctx context.Context, req *connect.Request[schemaV1.ResolveFloatRequest], @@ -265,6 +267,7 @@ func (s *OldFlagEvaluationService) ResolveFloat( return res, err } +//nolint:staticcheck func (s *OldFlagEvaluationService) ResolveObject( ctx context.Context, req *connect.Request[schemaV1.ResolveObjectRequest], diff --git a/flagd/pkg/service/flag-evaluation/flag_evaluator_types.go b/flagd/pkg/service/flag-evaluation/flag_evaluator_types.go index 6f20af9d0..416aca047 100644 --- a/flagd/pkg/service/flag-evaluation/flag_evaluator_types.go +++ b/flagd/pkg/service/flag-evaluation/flag_evaluator_types.go @@ -1,5 +1,3 @@ -//lint:file-ignore SA4003 old proto is deprecated but we want to serve it for a while - package service import ( @@ -20,10 +18,12 @@ type constraints interface { } type booleanResponse struct { + //nolint:staticcheck schemaV1Resp *connect.Response[schemaV1.ResolveBooleanResponse] evalV1Resp *connect.Response[evalV1.ResolveBooleanResponse] } +//nolint:staticcheck func (r *booleanResponse) SetResult(value bool, variant, reason string, metadata map[string]interface{}) error { newStruct, err := structpb.NewStruct(metadata) if err != nil { @@ -47,10 +47,12 @@ func (r *booleanResponse) SetResult(value bool, variant, reason string, metadata } type stringResponse struct { + //nolint:staticcheck schemaV1Resp *connect.Response[schemaV1.ResolveStringResponse] evalV1Resp *connect.Response[evalV1.ResolveStringResponse] } +//nolint:staticcheck func (r *stringResponse) SetResult(value string, variant, reason string, metadata map[string]interface{}) error { newStruct, err := structpb.NewStruct(metadata) if err != nil { @@ -74,10 +76,12 @@ func (r *stringResponse) SetResult(value string, variant, reason string, metadat } type floatResponse struct { + //nolint:staticcheck schemaV1Resp *connect.Response[schemaV1.ResolveFloatResponse] evalV1Resp *connect.Response[evalV1.ResolveFloatResponse] } +//nolint:staticcheck func (r *floatResponse) SetResult(value float64, variant, reason string, metadata map[string]interface{}) error { newStruct, err := structpb.NewStruct(metadata) if err != nil { @@ -85,6 +89,7 @@ func (r *floatResponse) SetResult(value float64, variant, reason string, metadat } if r.schemaV1Resp != nil { + // nolint:staticcheck r.schemaV1Resp.Msg.Value = value r.schemaV1Resp.Msg.Variant = variant r.schemaV1Resp.Msg.Reason = reason @@ -101,10 +106,12 @@ func (r *floatResponse) SetResult(value float64, variant, reason string, metadat } type intResponse struct { + //nolint:staticcheck schemaV1Resp *connect.Response[schemaV1.ResolveIntResponse] evalV1Resp *connect.Response[evalV1.ResolveIntResponse] } +//nolint:staticcheck func (r *intResponse) SetResult(value int64, variant, reason string, metadata map[string]interface{}) error { newStruct, err := structpb.NewStruct(metadata) if err != nil { @@ -127,10 +134,12 @@ func (r *intResponse) SetResult(value int64, variant, reason string, metadata ma } type objectResponse struct { + // nolint:staticcheck schemaV1Resp *connect.Response[schemaV1.ResolveObjectResponse] evalV1Resp *connect.Response[evalV1.ResolveObjectResponse] } +//nolint:staticcheck func (r *objectResponse) SetResult(value map[string]any, variant, reason string, metadata map[string]interface{}, ) error { diff --git a/test/zero-downtime-flagd-proxy/grpc.go b/test/zero-downtime-flagd-proxy/grpc.go index de7717e3c..dbf1fbc8e 100644 --- a/test/zero-downtime-flagd-proxy/grpc.go +++ b/test/zero-downtime-flagd-proxy/grpc.go @@ -11,6 +11,7 @@ import ( "google.golang.org/grpc/credentials/insecure" ) +//nolint:staticcheck func doRequests(grpcClient pb.FlagSyncServiceClient, waitSecondsBetweenRequests int) error { ctx := context.TODO() stream, err := grpcClient.SyncFlags(ctx, &schemav1.SyncFlagsRequest{