package main
import (
"fmt"
"html/template"
)
func main() {
fmt.Println(template.HTML("test") == "test")
htmlString := "test"
fmt.Println(template.HTML("test") == htmlString)
}
http://play.golang.org/p/dON4eLpGN8
document for template.HTML
:
http://golang.org/pkg/html/template/#HTML
The first comparison is true
. However, the second comparison yield following error :
invalid operation: "html/template".HTML("test") == htmlString (mismatched types "html/template".HTML and string)
Can someone explain what happened under the hood ?