Add *philosophy* and *under the hood* sections
This commit is contained in:
parent
b3496838ad
commit
6d0ee10322
21
README.md
21
README.md
@ -1,13 +1,26 @@
|
||||
# `protoc-gen-gotemplate`
|
||||
:open_file_folder: protocol generator + golang text/template (protobuf)
|
||||
|
||||
Generic protocol buffer generator backed by Golang's [text/template](https://golang.org/pkg/text/template).
|
||||
A generic **code**/script/data generator based on [Protobuf](https://developers.google.com/protocol-buffers/).
|
||||
|
||||
---
|
||||
|
||||
This is a generator plugin for the Google Protocol Buffers compiler (`protoc`).
|
||||
|
||||
The plugin can generate files based on a template directory using the [Golang's `text/template`](https://golang.org/pkg/text/template/) engine.
|
||||
The plugin parses **protobuf** files, generates an **ast**, and walks a local **templates directory** to generate files using the [Golang's `text/template` engine](https://golang.org/pkg/text/template/).
|
||||
|
||||
## Philosophy
|
||||
|
||||
* protobuf-first
|
||||
* no built-in template, only user defined templates
|
||||
* kiss, *keep it stupid simple*
|
||||
|
||||
## Under the hood
|
||||
|
||||
1. the *user* `protobuf` files are parsed by [`protoc`](https://github.com/google/protobuf/releases)
|
||||
2. the `ast` is generated by [`protoc-gen-go` helpers](https://github.com/golang/protobuf/tree/master/protoc-gen-go)
|
||||
3. the `ast` is given to [Golang's `text/template` engine](https://golang.org/pkg/text/template/) for each *user* template files
|
||||
4. the *funcmap* enriching the template engine is based on [Masterminds/sprig](https://github.com/Masterminds/sprig), and contains type-manipulation, iteration and language-specific helpers
|
||||
|
||||
## Usage
|
||||
|
||||
@ -52,6 +65,10 @@ Non-exhaustive list of new helpers:
|
||||
|
||||
See the project helpers for the complete list.
|
||||
|
||||
## Hacks
|
||||
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
* Install the **Go** compiler and tools from https://golang.org/doc/install
|
||||
|
Loading…
Reference in New Issue
Block a user