golang variable setting

go

Solution

You just need to replace `= template.New("foo")` with the type returned. In this case:

var templatefiles *template.Template // the return type of html/template.New()

templatefiles is now a global variable that contains a nil pointer to a type `template.Template`.

Problem

I need to set a variable at the beginning of my package that will later on be populated with parseFiles() but im not sure how to set the variable considering its not a string or int or anything generic like that. How would i set the variable without having to add some arbitrary name in there just to set it? ``` var templatefiles = template.New("foo") // Im having to do New("foo") just to set the variable // Later on adding files to original variable templatefiles.New("template name").Parse("Template text here") ```

Original source