gobuffalo / plush

The powerful template system that Go needs
MIT License
900 stars 56 forks source link

Panic on helper function with numbers in its name #6

Closed nzoschke closed 7 years ago

nzoschke commented 7 years ago

I tried to make a helper function called rfc3339, but calling it returns a panic. Renaming the function to iso works.

"rfc3339": func(t time.Time) string {
    return t.Format(time.RFC3339)
},
reflect: NumIn of non-func type
github.com/convox/interface/vendor/github.com/gobuffalo/buffalo.(*App).PanicHandler.func1.1
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/errors.go:60
runtime.call32
    /usr/local/go/src/runtime/asm_amd64.s:514
runtime.gopanic
    /usr/local/go/src/runtime/panic.go:489
reflect.(*rtype).NumIn
    /usr/local/go/src/reflect/type.go:1023
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalCallExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:456
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:89
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:584
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalBlockStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:569
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalForExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:527
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:97
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalReturnStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:598
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:591
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalBlockStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:569
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalIfExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:156
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalExpression
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:99
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).evalReturnStatement
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:598
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*compiler).compile
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/compiler.go:27
github.com/convox/interface/vendor/github.com/gobuffalo/plush.(*Template).Exec
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/template.go:75
github.com/convox/interface/vendor/github.com/gobuffalo/plush.BuffaloRenderer
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/plush/plush.go:23
github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/render.templateRenderer.exec
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/render/template.go:63
github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/render.templateRenderer.Render
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/render/template.go:28
github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/render.(*templateRenderer).Render
    <autogenerated>:12
github.com/convox/interface/vendor/github.com/gobuffalo/buffalo.(*DefaultContext).Render
    /go/src/github.com/convox/interface/vendor/github.com/gobuffalo/buffalo/default_context.go:141
github.com/convox/interface/actions.BuildsResource.List
markbates commented 7 years ago

Please make sure you have the latest version, there was a commit that fixed this a few weeks ago. https://github.com/gobuffalo/plush/commit/dacd21b2b4b4a5fe0806bd6cd5397d48000eb9a4