From fee245f5d4ddf788676fb5b7d9578ead318c8377 Mon Sep 17 00:00:00 2001 From: gfanton Date: Tue, 17 Jan 2017 16:07:38 +0100 Subject: [PATCH] Add concat example --- examples/concat/Makefile | 13 +++++++++++++ examples/concat/output/concat.txt | 3 +++ examples/concat/output/static.txt | 1 + examples/concat/proto/Eric.proto | 2 ++ examples/concat/proto/Francis.proto | 2 ++ examples/concat/proto/arnold.proto | 2 ++ examples/concat/templates/concat.txt.tmpl | 1 + examples/concat/templates/static.txt.tmpl | 1 + 8 files changed, 25 insertions(+) create mode 100644 examples/concat/Makefile create mode 100644 examples/concat/output/concat.txt create mode 100644 examples/concat/output/static.txt create mode 100644 examples/concat/proto/Eric.proto create mode 100644 examples/concat/proto/Francis.proto create mode 100644 examples/concat/proto/arnold.proto create mode 100644 examples/concat/templates/concat.txt.tmpl create mode 100644 examples/concat/templates/static.txt.tmpl diff --git a/examples/concat/Makefile b/examples/concat/Makefile new file mode 100644 index 0000000..60bc04f --- /dev/null +++ b/examples/concat/Makefile @@ -0,0 +1,13 @@ +.PHONY: build +build: + mkdir -p output + protoc -I. --gotemplate_out=template_dir=templates,debug=true,all=true:output proto/*.proto + + +.PHONY: re +re: clean build + + +.PHONY: clean +clean: + rm -rf output diff --git a/examples/concat/output/concat.txt b/examples/concat/output/concat.txt new file mode 100644 index 0000000..83e9930 --- /dev/null +++ b/examples/concat/output/concat.txt @@ -0,0 +1,3 @@ +I'm Eric +I'm Francis +I'm Arnold diff --git a/examples/concat/output/static.txt b/examples/concat/output/static.txt new file mode 100644 index 0000000..410455f --- /dev/null +++ b/examples/concat/output/static.txt @@ -0,0 +1 @@ +This is static text.This is static text.This is static text. \ No newline at end of file diff --git a/examples/concat/proto/Eric.proto b/examples/concat/proto/Eric.proto new file mode 100644 index 0000000..ce20a4b --- /dev/null +++ b/examples/concat/proto/Eric.proto @@ -0,0 +1,2 @@ +syntax = "proto3"; +package Eric; diff --git a/examples/concat/proto/Francis.proto b/examples/concat/proto/Francis.proto new file mode 100644 index 0000000..c381e5c --- /dev/null +++ b/examples/concat/proto/Francis.proto @@ -0,0 +1,2 @@ +syntax = "proto3"; +package Francis; diff --git a/examples/concat/proto/arnold.proto b/examples/concat/proto/arnold.proto new file mode 100644 index 0000000..f284210 --- /dev/null +++ b/examples/concat/proto/arnold.proto @@ -0,0 +1,2 @@ +syntax = "proto3"; +package Arnold; diff --git a/examples/concat/templates/concat.txt.tmpl b/examples/concat/templates/concat.txt.tmpl new file mode 100644 index 0000000..308309e --- /dev/null +++ b/examples/concat/templates/concat.txt.tmpl @@ -0,0 +1 @@ +I'm {{.File.Package}} diff --git a/examples/concat/templates/static.txt.tmpl b/examples/concat/templates/static.txt.tmpl new file mode 100644 index 0000000..82165d2 --- /dev/null +++ b/examples/concat/templates/static.txt.tmpl @@ -0,0 +1 @@ +This is static text. \ No newline at end of file