Package tmplfunc provides an extension of Go templates in which templates can be invoked as if they were functions.
See the package documentation for details.
Package tmplfunc provides an extension of Go templates in which templates can be invoked as if they were functions.
See the package documentation for details.
PHP Functions for Golang - phpfuncs PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. Y
Streaming Image Recognition by WebAssembly This project demonstrates how to process a video stream in real-time using WebAssembly and apply a pre-trai
iter Package iter provides generic, lazy iterators, functions for producing them from primitive types, as well as functions and methods for transformi
firebase-fx A wrapper for Google Cloud Functions that simplifies the deployment of serverless applications. Meant to expose a similar API to the Fireb
uritemplates -- import "github.com/jtacoma/uritemplates" Package uritemplates is a level 4 implementation of RFC 6570 (URI Template, http://tools.ietf
go.rice go.rice is a Go package that makes working with resources such as html,js,css,images and templates easy. During development go.rice will load
Render Render is a package that provides functionality for easily rendering JSON, XML, text, binary data, and HTML templates. This package is based on
confd confd is a lightweight configuration management tool focused on: keeping local configuration files up-to-date using data stored in etcd, consul,
Fast and customisable vulnerability scanner based on simple YAML based DSL. How • Install • For Security Engineers • For Developers • Documentation •
network-fingerprint Capture packet request/response pairs for a port and/or IP to aid in Network protocol based Nuclei Templates creation. Resources I
LaTTe Generate PDFs using LaTeX templates and JSON. Try out the demo! Find LaTTe on Docker Hub Table of Contents About Obtaining LaTTe Running & Using
tbd "to be defined" A really simple way to create text templates with placeholders. This tool is deliberately simple and trivial, no advanced features
Universal JSON, BSON, YAML, CSV, XML translator to ANY format using templates Key features Various input formats (json, bson, yaml, csv, xml) Flexible
📮 Go Email Sender Simple (but useful) email sender written in pure Go v1.17. Yes, yet another email package here! 😅 Support HTML templates and attac
URI Are you tired to build, concat, replace URL(s) (via shell scripts sed/awk/tr) from your awesome commandline pipeline? Well! here is the missing pi
Docker Deployment Templates One Stop repository for Docker Compose and Docker Templates for Deployment. Features Python (FastAPI, Flask) Screenshots D
Structured Data Templates Structured data templates are a templating engine that takes a simplified set of input parameters and transforms them into a
GoTSQL - A Better Way to Organize SQL codebase using Templates in Golang Installation through Go Get command $ go get github.com/migopsrepos/gotsql In
XCrafter 😄 x-crafter is used to quickly create templates from your prototype, also come with a builder to quickly regenerate your code. Install Using
tmplfunc
makes it possible to shadow predeclared functions by defining a template with the same name. I'm not sure if that's intentional and meant to be supported, but there's no error returned if one tries it and no documentation saying it shouldn't be done, so the rest of this issue report assumes so (even though it's not a feature I'd want to use myself).
It seems to work in most cases that I've tried while debugging this, but there's one edge case (that came up in practice in x/website, see golang/go#51989) that is problematic. A minified snippet that triggers it:
package main
import (
"fmt"
"html/template"
"os"
"rsc.io/tmplfunc"
)
func main() {
t := template.New("")
tmplfunc.MustParse(t, `
{{html .}}
{{define "html"}}{{.Field}}{{end}}
`)
err := t.Execute(os.Stdout, struct{ Field string }{Field: "a < b"})
fmt.Println("err:", err)
// Output:
// err: template: :1:0: executing "" at <html>: error calling html: template: :4:19: executing "html" at <.Field>: can't evaluate field Field in type string
}
(playground link: https://go.dev/play/p/B4eC3urDPjz)
The error is confusing and incorrect. It should say "in type struct{Field string}" not "in type string", and it shouldn't be an error since that type does in fact have that field.
Notably, changing any one of the following conditions makes this template work without errors and render expected output:
There is possibly a real bug in an edge case in the standard library that tmplfunc happens to expose here, or maybe this problem is entirely in this package—I'm not familiar with tmplfunc
enough look further. (I've tested with the latest version of this package using Go 1.18 and today's gotip.)
Sprig: Template functions for Go templates The Go language comes with a built-in template language, but not very many template functions. Sprig is a l
LaTTe Generate PDFs using LaTeX templates and JSON. Try out the demo! Find LaTTe on Docker Hub Table of Contents About Obtaining LaTTe Running & Using
tbd "to be defined" A really simple way to create text templates with placeholders. This tool is deliberately simple and trivial, no advanced features
Universal JSON, BSON, YAML, CSV, XML translator to ANY format using templates Key features Various input formats (json, bson, yaml, csv, xml) Flexible
go-templater The best project templater go-templater lets you use any project template you want and replace the variables with values from the config.
jaco Callable Ajax / http requests inside Golang templates Examples Examples #1 {{ define "content" }} <div id="myTodos"></div> <script>
soy Go implementation for Soy templates aka Google Closure Templates. See godoc for more details and usage examples. This project requires Go 1.12 or
cent Community edition nuclei templates, a simple tool that allows you to organize all the Nuclei templates offered by the community in one place Inst
Sprig: Template functions for Go templates The Go language comes with a built-in template language, but not very many template functions. Sprig is a l
Sprig: Template functions for Go templates The Go language comes with a built-in template language, but not very many template functions. Sprig is a l