From 58e9a3a2fb5354fbd810d6ce3b1b4ece401011f3 Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Sat, 27 Jul 2024 23:47:04 +0200 Subject: [PATCH] ci: ensure we build pb files from proto defs --- .github/workflows/go.yml | 5 ++ .gitignore | 3 + proto/dialout.pb.go | 145 --------------------------------------- proto/dialout_grpc.pb.go | 139 ------------------------------------- 4 files changed, 8 insertions(+), 284 deletions(-) delete mode 100644 proto/dialout.pb.go delete mode 100644 proto/dialout_grpc.pb.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2828d15..fa1c9b0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,6 +20,11 @@ jobs: go-version: ^1.22 id: go + - name: Install protoc + run: | + sudo apt-get update + sudo apt-get -y install protobuf-compiler protobuf-compiler-grpc + - name: Get dependencies run: make get-dependencies diff --git a/.gitignore b/.gitignore index 9b0aa28..aa97feb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .*.sw? +proto/dialout.pb.go +proto/dialout_grpc.pb.go + dc908_exporter cover.out diff --git a/proto/dialout.pb.go b/proto/dialout.pb.go deleted file mode 100644 index 4467f0a..0000000 --- a/proto/dialout.pb.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc v3.19.6 -// source: dialout.proto - -package proto - -import ( - reflect "reflect" - sync "sync" - - gnmi "github.com/openconfig/gnmi/proto/gnmi" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PublishResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *PublishResponse) Reset() { - *x = PublishResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_dialout_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PublishResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PublishResponse) ProtoMessage() {} - -func (x *PublishResponse) ProtoReflect() protoreflect.Message { - mi := &file_dialout_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PublishResponse.ProtoReflect.Descriptor instead. -func (*PublishResponse) Descriptor() ([]byte, []int) { - return file_dialout_proto_rawDescGZIP(), []int{0} -} - -var File_dialout_proto protoreflect.FileDescriptor - -var file_dialout_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x64, 0x69, 0x61, 0x6c, 0x6f, 0x75, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0c, 0x67, 0x6e, 0x6d, 0x69, 0x5f, 0x64, 0x69, 0x61, 0x6c, 0x6f, 0x75, 0x74, 0x1a, 0x0a, 0x67, - 0x6e, 0x6d, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x11, 0x0a, 0x0f, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x54, 0x0a, 0x0b, - 0x67, 0x4e, 0x4d, 0x49, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x75, 0x74, 0x12, 0x45, 0x0a, 0x07, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x12, 0x17, 0x2e, 0x67, 0x6e, 0x6d, 0x69, 0x2e, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, - 0x1d, 0x2e, 0x67, 0x6e, 0x6d, 0x69, 0x5f, 0x64, 0x69, 0x61, 0x6c, 0x6f, 0x75, 0x74, 0x2e, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, - 0x30, 0x01, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x73, 0x6f, 0x6e, 0x69, 0x78, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x64, - 0x63, 0x39, 0x30, 0x38, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_dialout_proto_rawDescOnce sync.Once - file_dialout_proto_rawDescData = file_dialout_proto_rawDesc -) - -func file_dialout_proto_rawDescGZIP() []byte { - file_dialout_proto_rawDescOnce.Do(func() { - file_dialout_proto_rawDescData = protoimpl.X.CompressGZIP(file_dialout_proto_rawDescData) - }) - return file_dialout_proto_rawDescData -} - -var file_dialout_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_dialout_proto_goTypes = []interface{}{ - (*PublishResponse)(nil), // 0: gnmi_dialout.PublishResponse - (*gnmi.SubscribeResponse)(nil), // 1: gnmi.SubscribeResponse -} -var file_dialout_proto_depIdxs = []int32{ - 1, // 0: gnmi_dialout.gNMIDialout.Publish:input_type -> gnmi.SubscribeResponse - 0, // 1: gnmi_dialout.gNMIDialout.Publish:output_type -> gnmi_dialout.PublishResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_dialout_proto_init() } -func file_dialout_proto_init() { - if File_dialout_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_dialout_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublishResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dialout_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_dialout_proto_goTypes, - DependencyIndexes: file_dialout_proto_depIdxs, - MessageInfos: file_dialout_proto_msgTypes, - }.Build() - File_dialout_proto = out.File - file_dialout_proto_rawDesc = nil - file_dialout_proto_goTypes = nil - file_dialout_proto_depIdxs = nil -} diff --git a/proto/dialout_grpc.pb.go b/proto/dialout_grpc.pb.go deleted file mode 100644 index fe163d1..0000000 --- a/proto/dialout_grpc.pb.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.6 -// source: dialout.proto - -package proto - -import ( - context "context" - - gnmi "github.com/openconfig/gnmi/proto/gnmi" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// GNMIDialoutClient is the client API for GNMIDialout service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type GNMIDialoutClient interface { - Publish(ctx context.Context, opts ...grpc.CallOption) (GNMIDialout_PublishClient, error) -} - -type gNMIDialoutClient struct { - cc grpc.ClientConnInterface -} - -func NewGNMIDialoutClient(cc grpc.ClientConnInterface) GNMIDialoutClient { - return &gNMIDialoutClient{cc} -} - -func (c *gNMIDialoutClient) Publish(ctx context.Context, opts ...grpc.CallOption) (GNMIDialout_PublishClient, error) { - stream, err := c.cc.NewStream(ctx, &GNMIDialout_ServiceDesc.Streams[0], "/gnmi_dialout.gNMIDialout/Publish", opts...) - if err != nil { - return nil, err - } - x := &gNMIDialoutPublishClient{stream} - return x, nil -} - -type GNMIDialout_PublishClient interface { - Send(*gnmi.SubscribeResponse) error - Recv() (*PublishResponse, error) - grpc.ClientStream -} - -type gNMIDialoutPublishClient struct { - grpc.ClientStream -} - -func (x *gNMIDialoutPublishClient) Send(m *gnmi.SubscribeResponse) error { - return x.ClientStream.SendMsg(m) -} - -func (x *gNMIDialoutPublishClient) Recv() (*PublishResponse, error) { - m := new(PublishResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// GNMIDialoutServer is the server API for GNMIDialout service. -// All implementations must embed UnimplementedGNMIDialoutServer -// for forward compatibility -type GNMIDialoutServer interface { - Publish(GNMIDialout_PublishServer) error - mustEmbedUnimplementedGNMIDialoutServer() -} - -// UnimplementedGNMIDialoutServer must be embedded to have forward compatible implementations. -type UnimplementedGNMIDialoutServer struct { -} - -func (UnimplementedGNMIDialoutServer) Publish(GNMIDialout_PublishServer) error { - return status.Errorf(codes.Unimplemented, "method Publish not implemented") -} -func (UnimplementedGNMIDialoutServer) mustEmbedUnimplementedGNMIDialoutServer() {} - -// UnsafeGNMIDialoutServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to GNMIDialoutServer will -// result in compilation errors. -type UnsafeGNMIDialoutServer interface { - mustEmbedUnimplementedGNMIDialoutServer() -} - -func RegisterGNMIDialoutServer(s grpc.ServiceRegistrar, srv GNMIDialoutServer) { - s.RegisterService(&GNMIDialout_ServiceDesc, srv) -} - -func _GNMIDialout_Publish_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(GNMIDialoutServer).Publish(&gNMIDialoutPublishServer{stream}) -} - -type GNMIDialout_PublishServer interface { - Send(*PublishResponse) error - Recv() (*gnmi.SubscribeResponse, error) - grpc.ServerStream -} - -type gNMIDialoutPublishServer struct { - grpc.ServerStream -} - -func (x *gNMIDialoutPublishServer) Send(m *PublishResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *gNMIDialoutPublishServer) Recv() (*gnmi.SubscribeResponse, error) { - m := new(gnmi.SubscribeResponse) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// GNMIDialout_ServiceDesc is the grpc.ServiceDesc for GNMIDialout service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var GNMIDialout_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "gnmi_dialout.gNMIDialout", - HandlerType: (*GNMIDialoutServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Publish", - Handler: _GNMIDialout_Publish_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "dialout.proto", -}