Last active
April 6, 2021 03:35
-
-
Save xNok/337bcb2a6dbf4fd284d92a38e63fabe3 to your computer and use it in GitHub Desktop.
This file contains 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 renderTemplate(fs fs.FS, file string | |
, args interface{}) bytes.Buffer { | |
var tpl bytes.Buffer | |
// read the block-kit definition as a go template | |
t, err := template.ParseFS(fs, file) | |
if err != nil { | |
panic(err) | |
} | |
// render the template using provided datas | |
err = t.Execute(&tpl, args) | |
if err != nil { | |
panic(err) | |
} | |
return tpl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment