diff --git a/examples/go-kit/Makefile b/examples/go-kit/Makefile index a9ffa0d..6cb08f1 100644 --- a/examples/go-kit/Makefile +++ b/examples/go-kit/Makefile @@ -7,8 +7,9 @@ TARGETS_TMPL := $(foreach source, $(SOURCES), $(source)_tmpl) build: $(TARGETS_GO) $(TARGETS_TMPL) $(TARGETS_GO): %_go: - protoc --gogo_out="$(dir $*)" "$*" + protoc --gogo_out=. "$*" $(TARGETS_TMPL): %_tmpl: @mkdir -p $(dir $*)gen - protoc -I. --gotemplate_out=template_dir=templates:output "$*" + protoc -I. --gotemplate_out=template_dir=templates:services "$*" + gofmt -w $(dir $*)gen diff --git a/examples/go-kit/output/services/session/session.pb.go b/examples/go-kit/output/services/session/session.pb.go deleted file mode 100644 index ca98145..0000000 --- a/examples/go-kit/output/services/session/session.pb.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by protoc-gen-go. -// source: services/session/session.proto -// DO NOT EDIT! - -/* -Package session is a generated protocol buffer package. - -It is generated from these files: - services/session/session.proto - -It has these top-level messages: - LoginRequest - LoginResponse - LogoutRequest - LogoutResponse -*/ -package session - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import 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.ProtoPackageIsVersion2 // please upgrade the proto package - -type LoginRequest struct { - Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` -} - -func (m *LoginRequest) Reset() { *m = LoginRequest{} } -func (m *LoginRequest) String() string { return proto.CompactTextString(m) } -func (*LoginRequest) ProtoMessage() {} -func (*LoginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -type LoginResponse struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"` -} - -func (m *LoginResponse) Reset() { *m = LoginResponse{} } -func (m *LoginResponse) String() string { return proto.CompactTextString(m) } -func (*LoginResponse) ProtoMessage() {} -func (*LoginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -type LogoutRequest struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` -} - -func (m *LogoutRequest) Reset() { *m = LogoutRequest{} } -func (m *LogoutRequest) String() string { return proto.CompactTextString(m) } -func (*LogoutRequest) ProtoMessage() {} -func (*LogoutRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type LogoutResponse struct { - ErrMsg string `protobuf:"bytes,1,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"` -} - -func (m *LogoutResponse) Reset() { *m = LogoutResponse{} } -func (m *LogoutResponse) String() string { return proto.CompactTextString(m) } -func (*LogoutResponse) ProtoMessage() {} -func (*LogoutResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func init() { - proto.RegisterType((*LoginRequest)(nil), "session.LoginRequest") - proto.RegisterType((*LoginResponse)(nil), "session.LoginResponse") - proto.RegisterType((*LogoutRequest)(nil), "session.LogoutRequest") - proto.RegisterType((*LogoutResponse)(nil), "session.LogoutResponse") -} - -func init() { proto.RegisterFile("services/session/session.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 231 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x50, 0xcb, 0x4a, 0xc5, 0x30, - 0x10, 0x35, 0xc2, 0xed, 0xd5, 0x41, 0xef, 0x62, 0x50, 0x6f, 0xe9, 0x42, 0x24, 0x20, 0xe8, 0xa6, - 0x82, 0x6e, 0x04, 0xc1, 0xa5, 0x2b, 0xdd, 0xb4, 0x1f, 0x20, 0x55, 0x87, 0x52, 0xa4, 0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x00, 0x00, -} diff --git a/examples/go-kit/output/services/sprint/sprint.pb.go b/examples/go-kit/output/services/sprint/sprint.pb.go deleted file mode 100644 index 41ccefe..0000000 --- a/examples/go-kit/output/services/sprint/sprint.pb.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by protoc-gen-go. -// source: services/sprint/sprint.proto -// DO NOT EDIT! - -/* -Package sprint is a generated protocol buffer package. - -It is generated from these files: - services/sprint/sprint.proto - -It has these top-level messages: - AddSprintRequest - AddSprintResponse - CloseSprintRequest - CloseSprintResponse - GetSprintRequest - GetSprintResponse - Sprint -*/ -package sprint - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import 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.ProtoPackageIsVersion2 // please upgrade the proto package - -type AddSprintRequest struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *AddSprintRequest) Reset() { *m = AddSprintRequest{} } -func (m *AddSprintRequest) String() string { return proto.CompactTextString(m) } -func (*AddSprintRequest) ProtoMessage() {} -func (*AddSprintRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -type AddSprintResponse struct { - Sprint *Sprint `protobuf:"bytes,1,opt,name=sprint" json:"sprint,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"` -} - -func (m *AddSprintResponse) Reset() { *m = AddSprintResponse{} } -func (m *AddSprintResponse) String() string { return proto.CompactTextString(m) } -func (*AddSprintResponse) ProtoMessage() {} -func (*AddSprintResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *AddSprintResponse) GetSprint() *Sprint { - if m != nil { - return m.Sprint - } - return nil -} - -type CloseSprintRequest struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` -} - -func (m *CloseSprintRequest) Reset() { *m = CloseSprintRequest{} } -func (m *CloseSprintRequest) String() string { return proto.CompactTextString(m) } -func (*CloseSprintRequest) ProtoMessage() {} -func (*CloseSprintRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type CloseSprintResponse struct { - ErrMsg string `protobuf:"bytes,1,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"` -} - -func (m *CloseSprintResponse) Reset() { *m = CloseSprintResponse{} } -func (m *CloseSprintResponse) String() string { return proto.CompactTextString(m) } -func (*CloseSprintResponse) ProtoMessage() {} -func (*CloseSprintResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -type GetSprintRequest struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` -} - -func (m *GetSprintRequest) Reset() { *m = GetSprintRequest{} } -func (m *GetSprintRequest) String() string { return proto.CompactTextString(m) } -func (*GetSprintRequest) ProtoMessage() {} -func (*GetSprintRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -type GetSprintResponse struct { - Sprint *Sprint `protobuf:"bytes,1,opt,name=sprint" json:"sprint,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=err_msg,json=errMsg" json:"err_msg,omitempty"` -} - -func (m *GetSprintResponse) Reset() { *m = GetSprintResponse{} } -func (m *GetSprintResponse) String() string { return proto.CompactTextString(m) } -func (*GetSprintResponse) ProtoMessage() {} -func (*GetSprintResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *GetSprintResponse) GetSprint() *Sprint { - if m != nil { - return m.Sprint - } - return nil -} - -type Sprint struct { - Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` - CreatedAt uint32 `protobuf:"varint,2,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` -} - -func (m *Sprint) Reset() { *m = Sprint{} } -func (m *Sprint) String() string { return proto.CompactTextString(m) } -func (*Sprint) ProtoMessage() {} -func (*Sprint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func init() { - proto.RegisterType((*AddSprintRequest)(nil), "sprint.AddSprintRequest") - proto.RegisterType((*AddSprintResponse)(nil), "sprint.AddSprintResponse") - proto.RegisterType((*CloseSprintRequest)(nil), "sprint.CloseSprintRequest") - proto.RegisterType((*CloseSprintResponse)(nil), "sprint.CloseSprintResponse") - proto.RegisterType((*GetSprintRequest)(nil), "sprint.GetSprintRequest") - proto.RegisterType((*GetSprintResponse)(nil), "sprint.GetSprintResponse") - proto.RegisterType((*Sprint)(nil), "sprint.Sprint") -} - -func init() { proto.RegisterFile("services/sprint/sprint.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 290 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x52, 0x4d, 0x4b, 0xc3, 0x40, - 0x10, 0x6d, 0xaa, 0x44, 0x32, 0xa5, 0xa5, 0x1d, 0x0f, 0xc6, 0xa8, 0x20, 0x8b, 0x14, 0x4f, 0x11, - 0xea, 0x2f, 0x68, 0x3d, 0x28, 0x88, 0x97, 0xb4, 0xf7, 0x12, 0xbb, 0x43, 0x09, 0xd8, 0x24, 0xee, - 0xac, 0xfe, 0x5f, 0xff, 0x89, 0xb0, 0xbb, 0xcd, 0x57, 0x8b, 0x27, 0x4f, 0xc9, 0xec, 0xbc, 0x7d, - 0x6f, 0xe6, 0xbd, 0x85, 0x6b, 0x26, 0xf5, 0x9d, 0x6d, 0x88, 0x1f, 0xb8, 0x54, 0x59, 0xae, 0xdd, - 0x27, 0x2e, 0x55, 0xa1, 0x0b, 0xf4, 0x6d, 0x25, 0xa6, 0x30, 0x9e, 0x4b, 0xb9, 0x34, 0x45, 0x42, - 0x9f, 0x5f, 0xc4, 0x1a, 0x11, 0x4e, 0xf3, 0x74, 0x47, 0xa1, 0x77, 0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diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/README.md.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/README.md.tmpl new file mode 100644 index 0000000..e69de29 diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/client/client.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/client/client.go.tmpl new file mode 100644 index 0000000..361fda1 --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/client/client.go.tmpl @@ -0,0 +1 @@ +package {{.File.Package}}_client \ No newline at end of file diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/cmd/{{.File.Package}}/main.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/cmd/{{.File.Package}}/main.go.tmpl new file mode 100644 index 0000000..85f0393 --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/cmd/{{.File.Package}}/main.go.tmpl @@ -0,0 +1 @@ +package main \ No newline at end of file diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/endpoints/endpoints.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/endpoints/endpoints.go.tmpl new file mode 100644 index 0000000..0189f91 --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/endpoints/endpoints.go.tmpl @@ -0,0 +1 @@ +package {{.File.Package}}_endpoints \ No newline at end of file diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/init/init.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/init/init.go.tmpl new file mode 100644 index 0000000..176248c --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/init/init.go.tmpl @@ -0,0 +1 @@ +package {{.File.Package}}_init \ No newline at end of file diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/transports/grpc/grpc.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/transports/grpc/grpc.go.tmpl new file mode 100644 index 0000000..9b86de9 --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/transports/grpc/grpc.go.tmpl @@ -0,0 +1 @@ +package {{.File.Package}}_transportgrpc \ No newline at end of file diff --git a/examples/go-kit/templates/{{.File.Package}}/gen/transports/http/http.go.tmpl b/examples/go-kit/templates/{{.File.Package}}/gen/transports/http/http.go.tmpl new file mode 100644 index 0000000..ff0559d --- /dev/null +++ b/examples/go-kit/templates/{{.File.Package}}/gen/transports/http/http.go.tmpl @@ -0,0 +1 @@ +package {{.File.Package}}_transporthttp \ No newline at end of file