-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When calling Render with a layout and a nil binding: panic: assignment to entry in nil map #134
Comments
I've found another way this blows up: When using
Is there any way to upgrade |
Found a way to get it to work (by adding an import to
|
(... Of course, upgrading the |
Not yet, v3 is still under development. We are trying to merge as many improvements/fixes |
The issue is that in
jetVarMap
it assumes that a nilbinding
should result in a niljet.VarMap
.template/jet/jet.go
Lines 233 to 237 in c4b2c7e
But if a layout is specified, it is then used to set a function and panics:
template/jet/jet.go
Lines 219 to 229 in c4b2c7e
This could be solved either by replacing
var bind jet.VarMap
withbind := make(jet.VarMap)
or by checking ifbind
is nil (andmake
ing it if not) inRender
right afterif len(layout) > 0 {
.Or in Render
I would send a pull request, but I'm not sure if it matters to you which way it is fixed. I would think it would be much clearer to put it in jetVarMap and get rid of the other calls to
make
there, but I guess there was a reason to not do that in the first place.The work around is for the caller of
Render
to just specify an emptyjet.VarMap
orfiber.Map
but that is not obvious andpanic
ing from forgetting is not great.The text was updated successfully, but these errors were encountered: