An ERB-style templating language for Go that transpiles templates into pure Go code at compile time.
Ego is an ERB-style templating language for Go that transpiles templates into pure Go code at compile time. It allows developers to write templates using Go syntax within <% %> tags, eliminating the need to learn a separate templating language. This approach ensures type safety and performance by treating templates as compile-time artifacts.
Go developers building web applications or services that require server-side HTML rendering with reusable components. It's particularly suited for teams already proficient in Go who want to leverage their existing language knowledge for templating.
Developers choose Ego over alternatives because it integrates seamlessly with Go's ecosystem, offering type safety and compile-time transpilation for better performance. Its unique selling point is allowing templates to be written in raw Go code, reducing the learning curve and enabling reuse of Go skills and packages.
An ERB-style templating language for Go.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Templates use raw Go code within <% %> tags, eliminating the need to learn a separate language, as shown in the README where developers can write standard Go control structures directly.
Transpilation to pure Go at compile time ensures type checking and performance optimizations, avoiding runtime interpretation overhead and leveraging Go's ecosystem.
Supports HTML-like component syntax with fields and closures, enabling modular UI elements like the Button example, and allows cross-package imports for library integration.
Print blocks (<%= %>) automatically escape HTML for security, with an unescaped variant (<%== %>) for raw output like JSON, providing a practical balance of safety and flexibility.
Cannot generate or modify templates dynamically at runtime; all templates must be pre-compiled, as stated in the Caveats, limiting use cases for ad-hoc content.
Ego does not provide built-in security mechanisms beyond basic escaping, placing the onus on developers to handle vulnerabilities, which the README explicitly acknowledges.
Requires running the ego CLI tool to transpile templates before compilation, adding an extra step to the build process compared to integrated templating solutions.