I am getting this error while running my project
# command-line-arguments
runtime.main_main·f: function main is undeclared in the main package
main.go
package main
import (
"html/template"
"net/http"
)
type Contact struct {
Email string
Subject string
Message string
}
func Main() {
tmpl := template.Must(template.ParseFiles("form.html"))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
tmpl.Execute(w, nil)
return
}
details := Contact{
Email: r.FormValue("email"),
Subject: r.FormValue("subject"),
Message: r.FormValue("message"),
}
_ = details
tmpl.Execute(w, struct{ succes bool }{true})
})
http.ListenAndServe(":8080", nil)
}
form.html
{{if.Success}}
<h1> Thanks we received the message</h1>
{{else}}
<h1> Contact</h1>
<form method="POST">
<label>Email:</label><br />
<input type="text" name="email"><br />
<label>Subject: </label><br />
<input type="text" name="Subject"><br />
<label>Message:</label><br />
<textarea name="message"></textarea>
<input type="submit">
</form>
{{end}}