And this is how am accessing the particular HTML template I want to send to the user.
var body bytes.Buffer
template, err := ParseTemplateDir("templates")
if err != nil {
log.Fatal("Could not parse template", err)
}
// where templateName can be verificationCode.html or resetPassword.html
template = template.Lookup(templateName)
template.Execute(&body, &data)
Now when I dynamically access any of the templates, I keep on getting the verificationCode.html template.
When I use resetPassword.html as the templateName, I still get the verificationCode.html template which is weird.
Please how do I fix this?
Do not reassign to template when looking up, but use a different name for the looked up template or do not assign the looked up template at all but do template.Lookup(templateName).Execute(&body, &data).