diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Makefile b/Makefile index 0f9642a..5e97c3b 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ .PHONY: proto proto: - cd e2e && protoc --go_out=. --go-json_out=logtostderr=true:. e2e.proto + mkdir -p build + go build -o build/protoc-gen-go-json . + export PATH=$(CURDIR)/build/:$$PATH && \ + cd e2e && protoc --go_out=. --go-json_out=logtostderr=true,v=10:. *.proto diff --git a/e2e/e2e_service.pb.go b/e2e/e2e_service.pb.go new file mode 100644 index 0000000..646bf3f --- /dev/null +++ b/e2e/e2e_service.pb.go @@ -0,0 +1,33 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: e2e_service.proto + +package e2e + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("e2e_service.proto", fileDescriptor_67ff392e014f279c) } + +var fileDescriptor_67ff392e014f279c = []byte{ + // 90 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x35, 0x4a, 0x8d, + 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, + 0x35, 0x4a, 0x95, 0xe2, 0x4c, 0x35, 0x82, 0xf2, 0x8d, 0x34, 0xb8, 0x98, 0x5d, 0x8d, 0x5c, 0x85, + 0x14, 0xb9, 0x58, 0x3d, 0x52, 0x73, 0x72, 0xf2, 0x85, 0xb8, 0xf4, 0x40, 0x72, 0x4e, 0x89, 0xc5, + 0x99, 0xc9, 0x52, 0x48, 0x6c, 0x25, 0x86, 0x24, 0x36, 0xb0, 0x06, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x60, 0x22, 0xc7, 0x12, 0x55, 0x00, 0x00, 0x00, +} diff --git a/e2e/e2e_service.proto b/e2e/e2e_service.proto new file mode 100644 index 0000000..6d09b43 --- /dev/null +++ b/e2e/e2e_service.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package e2e; + +import "e2e.proto"; + +service E2E { + rpc Hello(Basic) returns (Basic) {} +} diff --git a/gen/generator.go b/gen/generator.go index cc20113..7faed21 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -36,6 +36,11 @@ func New(reg *descriptor.Registry, opts Options) *generator { func (g *generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) { var files []*plugin.CodeGeneratorResponse_File for _, file := range targets { + if len(file.Messages) == 0 { + glog.V(1).Infof("Skipping %s, no messages", file.GetName()) + continue + } + glog.V(1).Infof("Processing %s", file.GetName()) code, err := g.generate(file) if err != nil {