type List struct { ProductsList []string Description string Link []string Success bool Failure bool } func Home(w http.ResponseWriter, r *http.Request) error { if r.URL.Path != "/" { fmt.Fprintln(w, "404 page not found") return nil } var user List for i := 0; i < 35; i++ { user.ProductsList = append(user.ProductsList, products.AccessAnotherData(i)) } user = List{ ProductsList: user.ProductsList, Success: true, Failure: false, } if r.Method == "GET" { match := database.Get("id1") if match { RefreshToken(w, r) return HomeTmpl.Execute(w, user.Success) } else { return HomeTmpl.Execute(w, user.Failure) } } else if r.Method == "POST" { ... // Code for Newsletter ... } return nil } Error can't evaluate field Success in type bool
{{if .Success}} <li> <h4><a href="/signout">Sign Out</a></h4> </li> {{end}} {{if .Failure}} <li> <h4><a href="/login">Log In</a></h4> </li> {{end}}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)