Standard library / html/template
html/template.ErrPartialCharset
Interpolation is attempted inside a JavaScript regexp character class. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
const ErrPartialCharset ErrorCodeWorking Example
Example Snippetgo
package main
import ( "errors" "fmt" "html/template" "io")
func main() { t := template.Must(template.New("x").Parse("<script>var r=/[{{.}}]/;</script>")) var e *template.Error err := t.Execute(io.Discard, nil) fmt.Println(errors.As(err, &e) && e.ErrorCode == template.ErrPartialCharset)}