Created
January 30, 2018 06:53
-
-
Save grapswiz/1e49e637a58b8e9d597172843ba0f70f to your computer and use it in GitHub Desktop.
テンプレート
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
下に入る | |
{{include "hoge.html"}} | |
上に入る |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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