Skip to content

text/template: t.New() doesn't save entry in t.tmpl #10926

@syst3mw0rm

Description

@syst3mw0rm
package main

import (
        "fmt"
        "text/template"
)

func main() {
        t, _ := template.New("base").Parse(`{{define "foo"}}foo{{end}}`)
        fmt.Println(t.Lookup("base"))
        fmt.Println(t.Lookup("foo"))

        t.New("bar")
        fmt.Println(t.Lookup("bar"))
}

returns

&{base 0x208304000 0x20829c400  }
&{foo 0x2083040e0 0x20829c400  }
<nil>

on commit 5b66e5d

Last 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