diff --git a/.github/workflows/server-main.yml b/.github/workflows/server-main.yml index 7452f0d..7a99594 100644 --- a/.github/workflows/server-main.yml +++ b/.github/workflows/server-main.yml @@ -44,7 +44,7 @@ jobs: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 - name: Generate files - run: make gen + run: go generate ./... - name: Go test run: go test ./... -race @@ -79,7 +79,7 @@ jobs: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 - name: Generate files - run: make gen + run: go generate ./... - name: Login to GHCR run: | diff --git a/Makefile b/Makefile deleted file mode 100644 index 003e235..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -run: - go run cmd/main.go - -test: - go test ./... -race - -gen: - go generate ./... - protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative pkg/proto/feature.proto diff --git a/internal/server/feature/service.go b/internal/server/feature/service.go index bb0ff64..0dca16c 100644 --- a/internal/server/feature/service.go +++ b/internal/server/feature/service.go @@ -1,4 +1,5 @@ //go:generate mockgen -source=service.go -destination=mocks/service_mock.go -package=mocks +//go:generate protoc --proto_path=../../../pkg/proto --go_out=../../../pkg/proto --go_opt=paths=source_relative --go-grpc_out=../../../pkg/proto --go-grpc_opt=paths=source_relative feature.proto package feature diff --git a/pkg/proto/feature.pb.go b/pkg/proto/feature.pb.go index 15c43bf..ef3db89 100644 --- a/pkg/proto/feature.pb.go +++ b/pkg/proto/feature.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.34.2 // protoc v5.27.2 -// source: pkg/proto/feature.proto +// source: feature.proto package proto @@ -32,7 +32,7 @@ type FeatureToggle struct { func (x *FeatureToggle) Reset() { *x = FeatureToggle{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_feature_proto_msgTypes[0] + mi := &file_feature_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +45,7 @@ func (x *FeatureToggle) String() string { func (*FeatureToggle) ProtoMessage() {} func (x *FeatureToggle) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_feature_proto_msgTypes[0] + mi := &file_feature_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -58,7 +58,7 @@ func (x *FeatureToggle) ProtoReflect() protoreflect.Message { // Deprecated: Use FeatureToggle.ProtoReflect.Descriptor instead. func (*FeatureToggle) Descriptor() ([]byte, []int) { - return file_pkg_proto_feature_proto_rawDescGZIP(), []int{0} + return file_feature_proto_rawDescGZIP(), []int{0} } func (x *FeatureToggle) GetFeatureId() string { @@ -88,7 +88,7 @@ type FeatureToggleChange struct { func (x *FeatureToggleChange) Reset() { *x = FeatureToggleChange{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_feature_proto_msgTypes[1] + mi := &file_feature_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101,7 +101,7 @@ func (x *FeatureToggleChange) String() string { func (*FeatureToggleChange) ProtoMessage() {} func (x *FeatureToggleChange) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_feature_proto_msgTypes[1] + mi := &file_feature_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114,7 +114,7 @@ func (x *FeatureToggleChange) ProtoReflect() protoreflect.Message { // Deprecated: Use FeatureToggleChange.ProtoReflect.Descriptor instead. func (*FeatureToggleChange) Descriptor() ([]byte, []int) { - return file_pkg_proto_feature_proto_rawDescGZIP(), []int{1} + return file_feature_proto_rawDescGZIP(), []int{1} } func (x *FeatureToggleChange) GetFeatureId() string { @@ -143,7 +143,7 @@ type FeatureSubscription struct { func (x *FeatureSubscription) Reset() { *x = FeatureSubscription{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_feature_proto_msgTypes[2] + mi := &file_feature_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -156,7 +156,7 @@ func (x *FeatureSubscription) String() string { func (*FeatureSubscription) ProtoMessage() {} func (x *FeatureSubscription) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_feature_proto_msgTypes[2] + mi := &file_feature_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -169,7 +169,7 @@ func (x *FeatureSubscription) ProtoReflect() protoreflect.Message { // Deprecated: Use FeatureSubscription.ProtoReflect.Descriptor instead. func (*FeatureSubscription) Descriptor() ([]byte, []int) { - return file_pkg_proto_feature_proto_rawDescGZIP(), []int{2} + return file_feature_proto_rawDescGZIP(), []int{2} } func (x *FeatureSubscription) GetFeatureToggles() []*FeatureToggle { @@ -179,58 +179,58 @@ func (x *FeatureSubscription) GetFeatureToggles() []*FeatureToggle { return nil } -var File_pkg_proto_feature_proto protoreflect.FileDescriptor - -var file_pkg_proto_feature_proto_rawDesc = []byte{ - 0x0a, 0x17, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x65, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x22, 0x50, 0x0a, 0x0d, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, - 0x67, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4e, 0x0a, 0x13, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, - 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, - 0x62, 0x6c, 0x65, 0x64, 0x22, 0x55, 0x0a, 0x13, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0e, 0x66, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x52, 0x0e, 0x66, 0x65, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x73, 0x32, 0x6e, 0x0a, 0x13, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x57, 0x0a, 0x17, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x46, - 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x1c, 0x2e, - 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x1c, 0x2e, 0x66, 0x65, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, - 0x67, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x30, 0x01, 0x42, 0x26, 0x5a, 0x24, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x6f, 0x68, 0x61, 0x6e, - 0x73, 0x65, 0x6e, 0x2f, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +var File_feature_proto protoreflect.FileDescriptor + +var file_feature_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x50, 0x0a, 0x0d, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x65, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4e, 0x0a, 0x13, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x49, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x55, 0x0a, 0x13, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x3e, 0x0a, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, + 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, + 0x65, 0x52, 0x0e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, + 0x73, 0x32, 0x6e, 0x0a, 0x13, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x57, 0x0a, 0x17, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x73, 0x12, 0x1c, 0x2e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x1a, 0x1c, 0x2e, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x46, 0x65, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x30, + 0x01, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x66, 0x6c, 0x6f, 0x68, 0x61, 0x6e, 0x73, 0x65, 0x6e, 0x2f, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, + 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( - file_pkg_proto_feature_proto_rawDescOnce sync.Once - file_pkg_proto_feature_proto_rawDescData = file_pkg_proto_feature_proto_rawDesc + file_feature_proto_rawDescOnce sync.Once + file_feature_proto_rawDescData = file_feature_proto_rawDesc ) -func file_pkg_proto_feature_proto_rawDescGZIP() []byte { - file_pkg_proto_feature_proto_rawDescOnce.Do(func() { - file_pkg_proto_feature_proto_rawDescData = protoimpl.X.CompressGZIP(file_pkg_proto_feature_proto_rawDescData) +func file_feature_proto_rawDescGZIP() []byte { + file_feature_proto_rawDescOnce.Do(func() { + file_feature_proto_rawDescData = protoimpl.X.CompressGZIP(file_feature_proto_rawDescData) }) - return file_pkg_proto_feature_proto_rawDescData + return file_feature_proto_rawDescData } -var file_pkg_proto_feature_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_pkg_proto_feature_proto_goTypes = []any{ +var file_feature_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_feature_proto_goTypes = []any{ (*FeatureToggle)(nil), // 0: feature.FeatureToggle (*FeatureToggleChange)(nil), // 1: feature.FeatureToggleChange (*FeatureSubscription)(nil), // 2: feature.FeatureSubscription } -var file_pkg_proto_feature_proto_depIdxs = []int32{ +var file_feature_proto_depIdxs = []int32{ 0, // 0: feature.FeatureSubscription.featureToggles:type_name -> feature.FeatureToggle 2, // 1: feature.FeatureStateService.SubscribeFeatureChanges:input_type -> feature.FeatureSubscription 1, // 2: feature.FeatureStateService.SubscribeFeatureChanges:output_type -> feature.FeatureToggleChange @@ -241,13 +241,13 @@ var file_pkg_proto_feature_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_pkg_proto_feature_proto_init() } -func file_pkg_proto_feature_proto_init() { - if File_pkg_proto_feature_proto != nil { +func init() { file_feature_proto_init() } +func file_feature_proto_init() { + if File_feature_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_pkg_proto_feature_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_feature_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*FeatureToggle); i { case 0: return &v.state @@ -259,7 +259,7 @@ func file_pkg_proto_feature_proto_init() { return nil } } - file_pkg_proto_feature_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_feature_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*FeatureToggleChange); i { case 0: return &v.state @@ -271,7 +271,7 @@ func file_pkg_proto_feature_proto_init() { return nil } } - file_pkg_proto_feature_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_feature_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*FeatureSubscription); i { case 0: return &v.state @@ -288,18 +288,18 @@ func file_pkg_proto_feature_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_pkg_proto_feature_proto_rawDesc, + RawDescriptor: file_feature_proto_rawDesc, NumEnums: 0, NumMessages: 3, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_pkg_proto_feature_proto_goTypes, - DependencyIndexes: file_pkg_proto_feature_proto_depIdxs, - MessageInfos: file_pkg_proto_feature_proto_msgTypes, + GoTypes: file_feature_proto_goTypes, + DependencyIndexes: file_feature_proto_depIdxs, + MessageInfos: file_feature_proto_msgTypes, }.Build() - File_pkg_proto_feature_proto = out.File - file_pkg_proto_feature_proto_rawDesc = nil - file_pkg_proto_feature_proto_goTypes = nil - file_pkg_proto_feature_proto_depIdxs = nil + File_feature_proto = out.File + file_feature_proto_rawDesc = nil + file_feature_proto_goTypes = nil + file_feature_proto_depIdxs = nil } diff --git a/pkg/proto/feature_grpc.pb.go b/pkg/proto/feature_grpc.pb.go index c03c723..b2bba08 100644 --- a/pkg/proto/feature_grpc.pb.go +++ b/pkg/proto/feature_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.5.1 // - protoc v5.27.2 -// source: pkg/proto/feature.proto +// source: feature.proto package proto @@ -124,5 +124,5 @@ var FeatureStateService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: "pkg/proto/feature.proto", + Metadata: "feature.proto", }