go: html/template: template.HTML strings escaped (Go 1.9 regression)

This has been reported by several users in the wild after we released Hugo 0.27 built on Go 1.9.

I have tried to make a simple standalone and failing test case, not yet successful.

I have, however, a failing test inside Hugo: https://travis-ci.org/gohugoio/hugo/builds/274496313?utm_source=github_status&utm_medium=notification

It passes fine on Go 1.8.3, fails on Go 1.9 and tip.

See https://github.com/gohugoio/hugo/pull/3878

The gist of it seems to be:

  • HTML strings put into the template context, i.e. data fetched from external resources such as Twitter (Tweets) and Instagram.
  • These are wrapped as template.HTML types to mark them as safe.

Note that we have had plenty of similar and passing tests in Hugo, so there is a corner case here that I don’t fully understand.

I will go back to using Go 1.8.3 (where I can).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 39 (36 by maintainers)

Most upvoted comments

I’m pretty frustrated that we didn’t manage to understand this well enough to restore the Go 1.8 behavior, but at this point I’m willing to just cut our losses and move on. We need to find a real owner for this package at some point.

I’m assuming this is related to #20842.

Cc: @stjj89