Skip to content

Instantly share code, notes, and snippets.

@grapswiz
Created January 30, 2018 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grapswiz/1e49e637a58b8e9d597172843ba0f70f to your computer and use it in GitHub Desktop.
Save grapswiz/1e49e637a58b8e9d597172843ba0f70f to your computer and use it in GitHub Desktop.
テンプレート
下に入る
{{include "hoge.html"}}
上に入る
func main() {
t := template.Must(template.New("hello.gohtml").Funcs(template.FuncMap{
"include": Include,
}).ParseFiles("hello.gohtml"))
err := t.Execute(os.Stdout, map[string]interface{}{})
if err != nil {
panic(err)
}
}
func Include(url string) string {
return url + " is included"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment