Closed gf3 closed 2 years ago
Perhaps I missed something important in the docs, but plush seems to have issues evaluating pointers:
package main import ( "fmt" "log" "github.com/gobuffalo/plush" ) type User struct { Name *string } func main() { html := `<html> <h1>user.Name: <%= user.Name %></h1> <h1>name: <%= name %></h1> <h1>name_ptr: <%= name_ptr %></h1> </html>` name := "Cool Guy" user := &User{Name: &name} ctx := plush.NewContext() ctx.Set("user", user) ctx.Set("name", name) ctx.Set("name_ptr", &name) s, err := plush.Render(html, ctx) if err != nil { log.Fatal(err) } fmt.Print(s) }
Go Playground ↑
<html> <h1>user.Name: </h1> <h1>name: Cool Guy</h1> <h1>name_ptr: </h1> </html>
Is this a known issue? Have I missed something basic?
Perhaps I missed something important in the docs, but plush seems to have issues evaluating pointers:
Go Playground ↑
Output
Is this a known issue? Have I missed something basic?