Pessoal, boa noite.
Sempre que tento executar o codigo utilizando o Go run da o erro abaixo.
PS C:\go2\src\loja> go run .\main.go panic: template: index.html:18: function "End" not defined
goroutine 1 [running]: html/template.Must(...) C:/Program Files/Go/src/html/template/template.go:374 main.init() C:/go2/src/loja/main.go:8 +0xa5 exit status 2
1 - arquivo main.go
package main
import (
"html/template"
"net/http"
)
var temp = template.Must(template.ParseGlob("templates/*.html"))
func main() {
http.HandleFunc("/", index)
http.ListenAndServe(":8000", nil)
}
func index(w http.ResponseWriter, r *http.Request) {
temp.ExecuteTemplate(w, "Index", nil)
}
2- arquivo index.html
{{define "Index"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>LOJA</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type"text/css" media="screen" href="main.css">
<scritp src="main.js"><</scritp>
</head>
<body>
<h1>Lojas Otto</h1>
</body>
</html>
{{End}}