The Go Template engine library collection with the most stars in GitHub

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

In the Go language world, in addition to the standard library's own html/template package, there are a wide variety of third-party template engine libraries, mostly from experience inheritance in other languages.

Mention the Go Language template engine, many people will naturally think of pongo2 template engine, which is the author of the first Go language template engine, almost all go mainstream popular web framework to support it, you even in Xormplus/xorm This database framework library can also see his figure, It's a go language template engine like the Django syntax, and if you've done Python before, you'll be very gracious.

Another I like the Go Language template engine is jet, it is powerful, and efficient, very good performance. Another big feature is IDE support, which has an idea plugin for developers to use, GitHub address: Https://github.com/jhsx/GoJetPlugin. This is also the author's main use of the Go Language template engine (previously there are some old projects using the Pongo2 template engine, the other Xormplus/xorm SQL template is also adopted pongo2).

There is also a Go Language template engine library that I want to mention is Go-template, which is more like a template engine adapter, and its biggest feature is that it supports standard html/template, Amber, Django, handlebars, Pug (Jade ), markdown Six kinds of template engine.

The Go Language template engine is mainly divided into two major categories, one is non-precompiled generated Go Code template engine (such as mentioned above), the other is precompiled generation Go Code template engine, this kind of template engine due to the innate advantage, performance will be better, whether the use of such engines, depends on the needs of your project to weigh. The leader of this kind of engine is hero, is also a Chinese developed the Go Language template engine library.

At present, I use the Go Language template engine is mainly Pongo2,jet and hero. If you want to recommend the Go Language template engine library, you are welcome to share the message.

Here is my list of Go Language template engine Library, I believe there is always a suitable for you:)

Project Name Stars Forks Description
Pongo2 1028 103 Django-syntax like Template-engine for Go
Mustache 853 128 Mustache.go is a implementation of the Mustache template language in go.
Hero 795 39 A handy, fast and powerful go template engine.
Quicktemplate 794 48 Fast, powerful, yet easy-to-use template engine for Go. Optimized for Speed, zero memory allocations in hot paths.
Amber 746 44 Amber is a elegant templating engine for Go programming Language, inspired from HAML and Jade
Ace 616 32 Ace is a HTML template engine for Go. This was inspired by Slim and Jade. This is a refinement of Gold.
Gorazor 594 70 Gorazor is the Go port of the Razor view engine originated from ASP.
Jet 400 22 Jet is a template engine developed to being easy-to-use, powerful, dynamic, yet secure and very fast.
Ego 323 25 Ego is a ERb style templating language for Go. It works by transpiling templates to pure Go and including them at compile time. These templates is light wrappers around the Go language itself.
Raymond 186 16 Handlebars for Golang
Fasttemplate 143 24 Simple and fast template engine for Go
Soy 120 18 Go implementation for Soy templates (Google Closure templates)
Kasia.go 70 5 Kasia.go is a go implementation of the Kasia templating system.
Ftmpl 49 1 Fast Typesafe Templating for Golang
Go-template 30 3 The best-of-work with different type of Template Engines and parsers for Go programming Language
Damsel 19 1 Markup language featuring HTML outlining via Css-selectors, extensible via pkg html/template and others.
Ego 15 0 Embedded go–a go-like Template language

Below is the performance comparison data for some go language template engine libraries from Go template benchmark

Full featured template Engines

amber 1,568
Name Runs µs/op b/op allocations/op
Ace 500,000 8.972 1,712
1,000,000 5.628 1,440
Golang 1,000,000 5.379 1,360 pns
handlebars 500, 00 0 10.174 4,210
jethtml 3, 00 0,000 1.209 0 0
Kasia 1,000,000 3.3 Wuyi 1,184
mustache 1,000,000 3.544
Pongo2 1,000,000 4.681 2,360
Soy 1,000,000 3.067 1,376 +

Precompilation to Go Code

Name Runs µs/op b/op allocations/op
Ego 5,000,000 0.793 85 8
Egon 3,000,000 1.541 149 12
Egonslinso 20,000,000 0.311 0 0
Ftmpl 3,000,000 1.298 1,141 12
Gorazor 5,000,000 1.014 613 11
Hero 30,000,000 0.162 0 0
Quicktemplate 20,000,000 0.289 0 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.