DEV Community


Discussion on: Learning API struggling with Go html/template need advice.

evanj profile image
Evan Jones

I don't see anything obviously wrong on first look. template#ExecuteTemplate can error out. I would check that error. Wouldn't pass http.ResponseWriter to ExecuteTemplate as well (use a temp &bytes.Buffer{}, then copy to http.ResponseWriter on success -- io.Copy).

When I've hit snags with templating similar to this I've spit everything out, {{ . }}. What's that provide?

Isolate the issue and throw into a repo/gist and I'm happy to take a peak. You might find the issue while doing so. Good luck!

ohhnate profile image
Samuel Fuller Author

Hey I appreciate the input and the help! I was able to fix the problem yesterday. The issue was regarding some

{{ . }}

reference on my html file that I didnt do correctly and was so certain it wasn't an issue I didn't include it on my initial post. Everything has went smoothly thus far today. I still feel a bit overwhelmed with templating and everything is starting to turn into a mess. I sorta want to work backward from where I am to get to a point where I fully understand everything. And do things more concisely. But anyways. Thank you very much for the help!

Forem Open with the Forem app