Open
Description
What version of Garble and Go are you using?
garble version:
mvdan.cc/garble v0.13.0
Build settings:
-buildmode exe
-compiler gc
CGO_ENABLED 1
GOARCH amd64
GOOS windows
GOAMD64 v1
go version:
go version go1.22.5 windows/amd64
What did you do?
[]Item list,iii cannot be printed.
{{range $value := .iii}}
value: {{$value.Size}}
{{end}}
garble build -mod=vendor -o bin/go_go.exe main.go
/main.go
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
type Item struct {
Page int
Size int
}
func main() {
r := gin.Default()
r.LoadHTMLGlob("templates/*")
r.GET("/index", func(c *gin.Context) {
a := gin.H{
"title": "titleAA",
"ce": "123456",
"iii": []Item{
{Page: 1, Size: 11},
{Page: 2, Size: 12},
{Page: 3, Size: 13},
},
}
c.HTML(http.StatusOK, "index.html", a)
})
r.Run()
}
/templates/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{.title}}</title>
</head>
<body>
iii:
{{range $value := .iii}}
value: {{$value.Size}}
{{end}}
</body>
</html>
GET:http://127.0.0.1:8080/index
Error #01: template: index.html:9:27: executing "index.html" at <$value.Size>: can't evaluate field Size in type main.B0aMZmq6