Skip to content

text/template: go1.18: erroneous evaluation of nil pointer #56769

@twmb

Description

@twmb

I'm opening this issue for awareness and to see if this is worthy of a back-port fix. My worry is that this was fixed accidentally somehow in some refactoring and that this issue may manifest again in the future in another change / refactoring. Since this issue does not manifest in the latest version, it may be worth just closing this issue.

What version of Go are you using (go version)?

1.18 errors,
1.19 does not.

Does this issue reproduce with the latest release?

No.

What did you do?

https://go.dev/play/p/xp70kdF4urk?v=goprev

Switching to 1.19, the program exits with no error / no output. The condition can be switched to {{ if .Inner }} and it works in both versions.

What did you expect to see?

No error / no output.

What did you see instead?

template: x:3:11: executing "x" at <.Inner.Field>: nil pointer evaluating *struct { Field string }.Field

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions