You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose to get rid of ERB in favor of native Go templates. Go has powerful generation tools, and it's better to use them.
Motivation
In a Go project, it is generally better to use Go tools for template generation to maintain consistency and leverage the native capabilities of the language. Using Go templates instead of ERB (Embedded Ruby) will:
Improve maintainability by using a single language for both code and templates.
Enhance readability for Go developers who may not be familiar with Ruby.
Simplify the build process by reducing dependencies on external tools.
Tasks
Identify all ERB templates currently used in the project.
Convert each ERB template to an equivalent Go template.
Use Makefile (Taskfile, simple script) instead of Rakefile.
While in theory I would prefer to use Go rather than another language and avoid the Ruby dependency, for templates I am not convinced. The erb templates are self-contained. But text/template would need some sort of setup to register the mul function and to pass in .ByteSizes.
Also, in my option, text/template syntax is rather awkward. e.g. pg_byte_size * 8 vs. mul $pg_byte_size 8.
I propose to get rid of ERB in favor of native Go templates. Go has powerful generation tools, and it's better to use them.
Motivation
In a Go project, it is generally better to use Go tools for template generation to maintain consistency and leverage the native capabilities of the language. Using Go templates instead of ERB (Embedded Ruby) will:
Tasks
Example of converting one file
int_test.go.erb
toint_test.go.tmpl
Current ERB Template
Equivalent Go Template:
Links
The text was updated successfully, but these errors were encountered: