Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Seems good to me.

Co-authored-by: Léo Rolland <[email protected]>
  • Loading branch information
Joffref and leorolland authored Dec 8, 2023
1 parent 2485b63 commit 40ed557
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impacting your velocity and maintainability as your model grows.
Large projects like Kubernetes already automate utility code code by leveraging on static analysis and code generation
(e.g. [kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) and [controller-gen](https://book.kubebuilder.io/reference/controller-gen)).
For example, [adding Go "markers" comments on interfaces declaration](https://book.kubebuilder.io/reference/markers)
indicates business rules to the generator that will created the associated code.
indicates business rules to the generator that will create the associated code.
Why wouldn't we create our own markers and generator ?

#### Parenthesis on reflection
Expand All @@ -42,7 +42,7 @@ There are many libraries that use tags to generate code (e.g. [gorm](https://gor

The issues with tags are:
- they use reflection under the hood
- they only work on structs and not on other types (e.g. interfaces)
- they only work on structs attributes and not on other types (e.g. methods, interfaces)

**We wanted a simple, generic and testable solution to introspect our models and generate code at compile time.**

Expand Down
2 changes: 1 addition & 1 deletion docs/how_to_write_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thus, a key part of GenZ is writing templates that will be used to generate code
## Template Syntax

GenZ uses [go templates](https://pkg.go.dev/text/template) to generate code. Thus, you can use all the features of go templates to generate your code.
Plus, we use [sprig](http://masterminds.github.io/sprig) to provide additional functions to the templates.
additionally, we included [sprig](http://masterminds.github.io/sprig) to provide additional functions to the templates (the same as in Helm)

## Template Data

Expand Down
6 changes: 4 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## Why testing templates?

Testing your templates is a good way to ensure that your templates are working as expected.
It's also a good way to ensure that your templates are not broken when you update GenZ or your templates themselves.
Testing your templates is a good way to ensure that:
* the generated code is exactly the one you expect
* the generated code does what you expect from it (by running it against unit tests)
It's also a good way catch regressions when you update GenZ or your templates themselves.

## How to test your templates?

Expand Down

0 comments on commit 40ed557

Please sign in to comment.