Skip to content

text/template: doesn't return template on lookup #10910

@syst3mw0rm

Description

@syst3mw0rm
package main

import (
    "fmt"
    "text/template"
)

func main() {
    t := template.New("base")
    fmt.Println(t.Lookup("base"))

    t.Parse("{{define \"test\"}}{{end}}")
    fmt.Println(t.Lookup("test"))
    fmt.Println(t.Lookup("base"))
}

returns

<nil>
&{test 0x2083060e0 0x20829c400  }
&{base 0x208306000 0x20829c400  }

on tip b21ff39

First line of output should not be <nil>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions