This is a creation in Article, where the information may have evolved or changed.
Package Mainimport ("FMT", "Html/template" "Net/http" "OS") type person struct {Name stringage intemails []stringcompan Y stringrole string}type onlineuser struct {User []*personlogintime string}func Handler (w http. Responsewriter, R *http. Request) {dumx: = person{name: "Zoro", Age:27, Emails: []string{"dg@gmail.com", "dk@hotmail.com"},company: "Omron", Role : "SE"}chxd: = person{name: "Chxd", Age:27, Emails: []string{"test@gmail.com", "d@hotmail.com"}}onlineuser: = Onlineuser {User: []*person{&dux, &ch}}//t: = template. New ("person template")//t, err: = T.parse (Templ) T, err: = template. Parsefiles ("tmpl.html") checkerror (err) Err = T.execute (w, Onlineuser) checkerror (Err)}func Main () {http. Handlefunc ("/", Handler) http. Listenandserve (": 8888", nil)}func CheckError (err error) {if err! = Nil {fmt. PRINTLN ("Fatal error", Err. Error ()) OS. Exit (1)}}======================================