Refactor the go-kit templates to make imports generic
This commit is contained in:
parent
f9e191c6a4
commit
df709b52ac
@ -4,8 +4,9 @@ package {{.File.Package}}_endpoints
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/pb"
|
pb "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/pb"
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/pb"
|
pb "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/pb"
|
||||||
|
endpoints "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/endpoints"
|
||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
endpoint "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/endpoints"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// avoid import errors
|
// avoid import errors
|
||||||
var _ = fmt.Errorf
|
var _ = fmt.Errorf
|
||||||
|
|
||||||
func MakeGRPCServer(ctx context.Context, endpoints endpoint.Endpoints) pb.{{.File.Package | title}}ServiceServer {
|
func MakeGRPCServer(ctx context.Context, endpoints endpoints.Endpoints) pb.{{.File.Package | title}}ServiceServer {
|
||||||
options := []grpctransport.ServerOption{}
|
options := []grpctransport.ServerOption{}
|
||||||
return &grpcServer{
|
return &grpcServer{
|
||||||
{{range .Service.Method}}
|
{{range .Service.Method}}
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
|
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/pb"
|
pb "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/pb"
|
||||||
gokit_endpoint "github.com/go-kit/kit/endpoint"
|
gokit_endpoint "github.com/go-kit/kit/endpoint"
|
||||||
httptransport "github.com/go-kit/kit/transport/http"
|
httptransport "github.com/go-kit/kit/transport/http"
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/endpoints"
|
endpoints "{{cat .GoPWD "/" .DestinationDir | nospace | clean}}/endpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
{{range .Service.Method}}
|
{{range .Service.Method}}
|
||||||
|
Loading…
Reference in New Issue
Block a user