Text and HTML templates / Custom functions / Essen

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "log" "os" "text/template" ) const tmplStr = `5 + 5 = {{ sum 5 .Arg }} ` func sum(x, y int) int { return x + y } func main() { customFunctions := template.FuncMap{ "sum": sum, } t := template.Must(template.New("func").Funcs(customFunctions).Parse(tmplStr)) data := struct { Arg int }{ Arg: 5, } err := t.Execute(os.Stdout, data) if err != nil { log.Fatalf("t.Execute() failed with '%s'\n", err) } }
Editor Settings
Theme
Key bindings
Full width
Lines