This is my original code.
outside of the go routine w variable is [image: Screen Shot 2019-07-16 at 20.57.35.png] <about:invalid#zClosurez> But inside the go routine [image: Screen Shot 2019-07-16 at 20.58.17.png] <about:invalid#zClosurez> I don't understand why. Anyone can help about this ? func Make(w http.ResponseWriter, r *http.Request, app App) { runtime.GOMAXPROCS(4) flusher, ok := w.(http.Flusher) if !ok { panic("expected http.ResponseWriter to be an http.Flusher") } w.Header().Set("X-Content-Type-Options", "nosniff") tmpl, err := template.New("app").Parse(app.Page.Content) if err != nil { panic("An Error occured when parsing html") return } err = tmpl.Execute(w, "") if err != nil { panic("Error in Template.Execute") } flusher.Flush() for _, gateway := range app.Gateway { go func(gateway Gateway) { tmpl, err := template.New(gateway.Name).Parse(gateway.Content) if err != nil { panic("An Error occured when parsing html") } err = tmpl.Execute(w, "") if err != nil { panic(err) } defer flusher.Flush() }(gateway) } } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/17998013-2d1b-4921-8fa4-061a5b217875%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.