How to pass value in defined template

I have created a text/template which has the “define” block i.e “t1”. The “define” block is expecting a variable named Name. I used that “t1” in the main template. I passed the value of the variable Name, it is showing in t1 whereas it shows value in the main template

package main

import (
	"log"
	"os"
	"text/template"
)

const tmptTxt = `
{{- define "t1" }} {{.Name}} the first tempalte {{ end -}}
{{template "t1"}}
{{ .Name }}
`

func main() {
	t, err := template.New("temp").Parse(tmptTxt)
	if err != nil {
		log.Fatal(err)
	}
	t.Execute(os.Stdout, person{Name: "Prithvi"})
}

type person struct {
	Name string
}

Output

 <no value> the first tempalte 
Prithvi

How to pass value in {{- define "t1" }} {{.Name}} the first tempalte {{ end -}} of the code from main template?

take a look into your template, see this examples

I am trying to learn how to send value in {{- define "t1" }} {{.Name}} the first template {{ end -}}. I am getting . I know how to send value with normal template.

I got the solution. I forgot to pass the value using dot(.) while calling the template. Following is fixed template text:

const tmptTxt = `
{{- define "t1" }} {{.Name}} the first tempalte {{ end -}}
{{template "t1" .}}
{{ .Name }}
`

great