blob: 68e131bdc27b17fcad0241583e1b45442058ffe8 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package swift
import (
var tmplCache = map[string]*template.Template{}
// parseTmpl parses a template and caches the parsed value.
// Each template body must be associated with a unique name.
func parseTmpl(name string, body string) *template.Template {
if tmpl, ok := tmplCache[name]; ok {
return tmpl
tmpl := template.Must(template.New(name).Parse(body))
tmplCache[name] = tmpl
return tmpl