chore: switch to moul.io/protoc-gen-gotemplate
This commit is contained in:
parent
ac2e25e74f
commit
c015ff9539
@ -1,5 +1,6 @@
|
|||||||
language: go
|
language: go
|
||||||
go: 1.8.x
|
go: 1.11.x
|
||||||
|
go_import_path: moul.io/protoc-gen-gotemplate
|
||||||
install:
|
install:
|
||||||
- go get github.com/Masterminds/glide
|
- go get github.com/Masterminds/glide
|
||||||
- wget https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/.travis/install-protoc.sh && chmod +x install-protoc.sh && ./install-protoc.sh 3.4.0
|
- wget https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/master/.travis/install-protoc.sh && chmod +x install-protoc.sh && ./install-protoc.sh 3.4.0
|
||||||
|
@ -8,7 +8,7 @@ RUN apk --update add make git go rsync libc-dev \
|
|||||||
&& go get -u golang.org/x/tools/cmd/goimports
|
&& go get -u golang.org/x/tools/cmd/goimports
|
||||||
|
|
||||||
# Install protoc-gen-gotemplate
|
# Install protoc-gen-gotemplate
|
||||||
COPY . /go/src/github.com/moul/protoc-gen-gotemplate
|
COPY . /go/src/moul.io/protoc-gen-gotemplate
|
||||||
WORKDIR /go/src/github.com/moul/protoc-gen-gotemplate
|
WORKDIR /go/src/moul.io/protoc-gen-gotemplate
|
||||||
RUN git remote set-url origin https://github.com/moul/protoc-gen-gotemplate
|
RUN git remote set-url origin https://github.com/moul/protoc-gen-gotemplate
|
||||||
RUN go install . ./cmd/web-editor
|
RUN go install . ./cmd/web-editor
|
||||||
|
@ -133,7 +133,7 @@ See the project helpers for the complete list.
|
|||||||
|
|
||||||
* Install the **Go** compiler and tools from https://golang.org/doc/install
|
* Install the **Go** compiler and tools from https://golang.org/doc/install
|
||||||
* Install **protobuf**: `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}`
|
* Install **protobuf**: `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}`
|
||||||
* Install **protoc-gen-gotemplate**: `go get -u github.com/moul/protoc-gen-gotemplate`
|
* Install **protoc-gen-gotemplate**: `go get -u moul.io/protoc-gen-gotemplate`
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
|
@ -129,10 +129,10 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div>Command: <code>protoc --gotemplate_out=template_dir=.:. example.proto</code></div>
|
<div>Command: <code>protoc --gotemplate_out=template_dir=.:. example.proto</code></div>
|
||||||
<div>Powered by <a href="https://github.com/moul/protoc-gen-gotemplate">protoc-gen-gotemplate</a></div>
|
<div>Powered by <a href="https://moul.io/protoc-gen-gotemplate">protoc-gen-gotemplate</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="https://github.com/moul/protoc-gen-gotemplate"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
<a href="https://moul.io/protoc-gen-gotemplate"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
"github.com/golang/protobuf/protoc-gen-go/descriptor"
|
||||||
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
||||||
|
|
||||||
pgghelpers "github.com/moul/protoc-gen-gotemplate/helpers"
|
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GenericTemplateBasedEncoder struct {
|
type GenericTemplateBasedEncoder struct {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package: github.com/moul/protoc-gen-gotemplate/examples/go-kit
|
package: moul.io/protoc-gen-gotemplate/examples/go-kit
|
||||||
import:
|
import:
|
||||||
- package: github.com/go-kit/kit
|
- package: github.com/go-kit/kit
|
||||||
subpackages:
|
subpackages:
|
||||||
|
@ -12,23 +12,23 @@ import (
|
|||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
session_svc "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session"
|
session_svc "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session"
|
||||||
session_endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
session_endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||||
session_pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
session_pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
session_grpctransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/transports/grpc"
|
session_grpctransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/transports/grpc"
|
||||||
session_httptransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/transports/http"
|
session_httptransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/transports/http"
|
||||||
|
|
||||||
sprint_svc "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint"
|
sprint_svc "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint"
|
||||||
sprint_endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
sprint_endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
||||||
sprint_pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
sprint_pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
sprint_grpctransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/transports/grpc"
|
sprint_grpctransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/transports/grpc"
|
||||||
sprint_httptransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/transports/http"
|
sprint_httptransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/transports/http"
|
||||||
|
|
||||||
user_svc "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user"
|
user_svc "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user"
|
||||||
user_endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
user_endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
||||||
user_pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
user_pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
user_grpctransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/transports/grpc"
|
user_grpctransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/transports/grpc"
|
||||||
user_httptransport "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/transports/http"
|
user_httptransport "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/transports/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(conn *grpc.ClientConn, logger log.Logger) pb.SessionServiceServer {
|
func New(conn *grpc.ClientConn, logger log.Logger) pb.SessionServiceServer {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// avoid import errors
|
// avoid import errors
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
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/session/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = log.Printf
|
var _ = log.Printf
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct{}
|
type Service struct{}
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(conn *grpc.ClientConn, logger log.Logger) pb.SprintServiceServer {
|
func New(conn *grpc.ClientConn, logger log.Logger) pb.SprintServiceServer {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// avoid import errors
|
// avoid import errors
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
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/sprint/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = log.Printf
|
var _ = log.Printf
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/sprint/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct{}
|
type Service struct{}
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(conn *grpc.ClientConn, logger log.Logger) pb.UserServiceServer {
|
func New(conn *grpc.ClientConn, logger log.Logger) pb.UserServiceServer {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-kit/kit/endpoint"
|
"github.com/go-kit/kit/endpoint"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
grpctransport "github.com/go-kit/kit/transport/grpc"
|
grpctransport "github.com/go-kit/kit/transport/grpc"
|
||||||
oldcontext "golang.org/x/net/context"
|
oldcontext "golang.org/x/net/context"
|
||||||
|
|
||||||
endpoints "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// avoid import errors
|
// avoid import errors
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
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/user/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = log.Printf
|
var _ = log.Printf
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct{}
|
type Service struct{}
|
||||||
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package dummy;
|
package dummy;
|
||||||
|
|
||||||
option go_package = "github.com/moul/protoc-gen-gotemplate/examples/helpers";
|
option go_package = "moul.io/protoc-gen-gotemplate/examples/helpers";
|
||||||
|
|
||||||
message Dummy1 {
|
message Dummy1 {
|
||||||
float aaa = 1;
|
float aaa = 1;
|
||||||
|
@ -3,7 +3,7 @@ build:
|
|||||||
mkdir -p output
|
mkdir -p output
|
||||||
|
|
||||||
# generate pb.go inluding imported proto
|
# generate pb.go inluding imported proto
|
||||||
protoc --go_out=Mproto/common.proto=github.com/moul/protoc-gen-gotemplate/examples/import/output/models/common:./output proto/article.proto
|
protoc --go_out=Mproto/common.proto=moul.io/protoc-gen-gotemplate/examples/import/output/models/common:./output proto/article.proto
|
||||||
protoc --go_out=,plugins=grpc:./output proto/common.proto
|
protoc --go_out=,plugins=grpc:./output proto/common.proto
|
||||||
|
|
||||||
# build our go file based on our template
|
# build our go file based on our template
|
||||||
|
@ -17,7 +17,7 @@ package article
|
|||||||
import proto "github.com/golang/protobuf/proto"
|
import proto "github.com/golang/protobuf/proto"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
import common "github.com/moul/protoc-gen-gotemplate/examples/import/output/models/common"
|
import common "moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ = proto.Marshal
|
var _ = proto.Marshal
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
package company
|
package company
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/moul/protoc-gen-gotemplate/examples/import/output/models/article"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/article"
|
||||||
"github.com/moul/protoc-gen-gotemplate/examples/import/output/models/common"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
@ -37,4 +37,4 @@ func (sdk *Sdk) GetArticle(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
package {{.File.Package}}
|
package {{.File.Package}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/moul/protoc-gen-gotemplate/examples/import/output/models/article"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/article"
|
||||||
"github.com/moul/protoc-gen-gotemplate/examples/import/output/models/common"
|
"moul.io/protoc-gen-gotemplate/examples/import/output/models/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
@ -38,4 +38,4 @@ func (sdk *Sdk) {{$m.Name}}(ctx context.Context, {{if $t.OneofDecl}} req *{{$pkg
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{end}} {{/* streaming ifs */}}
|
{{end}} {{/* streaming ifs */}}
|
||||||
{{end}}{{end}} {{/* range with */}}
|
{{end}}{{end}} {{/* range with */}}
|
||||||
|
@ -9,7 +9,7 @@ build:
|
|||||||
protoc -I./proto --go_out=plugins=grpc:output proto/aaa/aaa.proto
|
protoc -I./proto --go_out=plugins=grpc:output proto/aaa/aaa.proto
|
||||||
protoc -I./proto --go_out=plugins=grpc:output proto/bbb/bbb.proto
|
protoc -I./proto --go_out=plugins=grpc:output proto/bbb/bbb.proto
|
||||||
@rm -rf output/aaa output/bbb
|
@rm -rf output/aaa output/bbb
|
||||||
@mv output/github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/* output/
|
@mv output/moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/* output/
|
||||||
@rm -rf output/github.com
|
@rm -rf output/github.com
|
||||||
|
|
||||||
@# protoc-gen-gotemplate
|
@# protoc-gen-gotemplate
|
||||||
|
@ -17,7 +17,7 @@ package bbb
|
|||||||
import proto "github.com/golang/protobuf/proto"
|
import proto "github.com/golang/protobuf/proto"
|
||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
import the_aaa_package "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
import the_aaa_package "moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
|
@ -4,7 +4,7 @@ package bbb
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
"moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/aaa"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
option go_package = "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/aaa";
|
option go_package = "moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/aaa";
|
||||||
|
|
||||||
package the.aaa.package;
|
package the.aaa.package;
|
||||||
|
|
||||||
@ -9,4 +9,4 @@ message AaaRequest {
|
|||||||
}
|
}
|
||||||
message AaaReply {
|
message AaaReply {
|
||||||
string error = 1;
|
string error = 1;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package the.bbb.package;
|
package the.bbb.package;
|
||||||
|
|
||||||
option go_package = "github.com/moul/protoc-gen-gotemplate/examples/single-package-mode/output/bbb";
|
option go_package = "moul.io/protoc-gen-gotemplate/examples/single-package-mode/output/bbb";
|
||||||
|
|
||||||
import "aaa/aaa.proto";
|
import "aaa/aaa.proto";
|
||||||
|
|
||||||
@ -16,4 +16,4 @@ message BbbRequest {
|
|||||||
}
|
}
|
||||||
message BbbReply {
|
message BbbReply {
|
||||||
bool done = 1;
|
bool done = 1;
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -1,4 +1,4 @@
|
|||||||
package main
|
package main // import "moul.io/protoc-gen-gotemplate"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
"github.com/golang/protobuf/protoc-gen-go/plugin"
|
||||||
ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
|
ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
|
||||||
|
|
||||||
pgghelpers "github.com/moul/protoc-gen-gotemplate/helpers"
|
pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* the good old ./generate.sh bash script
|
* the good old ./generate.sh bash script
|
||||||
* go:generate
|
* go:generate
|
||||||
* make
|
* make
|
||||||
* protobuf + [protoc-gen-gotemplate](https://github.com/moul/protoc-gen-gotemplate)
|
* protobuf + [protoc-gen-gotemplate](https://moul.io/protoc-gen-gotemplate)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ package sessionsvc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/session/gen/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Service struct{}
|
type Service struct{}
|
||||||
@ -94,8 +94,8 @@ package {{.File.Package}}_httptransport
|
|||||||
import (
|
import (
|
||||||
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 "moul.io/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/{{.File.Package}}/gen/pb"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -105,8 +105,8 @@ package user_httptransport
|
|||||||
import (
|
import (
|
||||||
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/user/gen/endpoints"
|
endpoints "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/endpoints"
|
||||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
pb "moul.io/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ func RegisterHandlers(ctx context.Context, svc pb.UserServiceServer, mux *http.S
|
|||||||
|
|
||||||
# generation usages
|
# generation usages
|
||||||
|
|
||||||
* go-kit boilerplate (see [examples/go-kit](https://github.com/moul/protoc-gen-gotemplate/tree/master/examples/go-kit))
|
* go-kit boilerplate (see [examples/go-kit](https://moul.io/protoc-gen-gotemplate/tree/master/examples/go-kit))
|
||||||
* k8s configuration
|
* k8s configuration
|
||||||
* Dockerfile
|
* Dockerfile
|
||||||
* documentation
|
* documentation
|
||||||
@ -243,5 +243,5 @@ func RegisterHandlers(ctx context.Context, svc pb.UserServiceServer, mux *http.S
|
|||||||
|
|
||||||
# questions?
|
# questions?
|
||||||
|
|
||||||
### github.com/moul/protoc-gen-gotemplate
|
### moul.io/protoc-gen-gotemplate
|
||||||
### @moul
|
### @moul
|
||||||
|
Loading…
x
Reference in New Issue
Block a user