[go-nuts] Map value assignment inside if loop

2017-03-11 Thread priyank pulumati
Hello, Go newbie here func (data map[string] interface {}) { if len(data) == 0 { data := make(map[string]interface{}) data["user"], _ = store.GetUser(context.Get(req, "userid").(string)) } else { data["user"], _ = store.GetUser(context.Get(req, "userid").(string)) } log.Println(data["user"]

[go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
hello, im building a go web app and facing an issue with Executing templates with custom functions func CustomTemplateExecute(res http.ResponseWriter, req *http.Request, templateName string, data map[string]interface{}) { // Append common templates and data structs and execute template var funcM

[go-nuts] Re: template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
Error when i say template.New(templates.BASE) template: templates/base.html: "templates/base.html" is an incomplete or empty template -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
Files call has a "templateName" argument in it. The ParseFiles > function only takes file paths, not template names. > > And templates.New takes a template name, not a file path. > > Hope this helps. > > On Sat, Mar 25, 2017 at 9:14 AM, priyank pulumati > wrote: >

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
a "templateName" argument in it. The ParseFiles > function only takes file paths, not template names. > > And templates.New takes a template name, not a file path. > > Hope this helps. > > On Sat, Mar 25, 2017 at 9:14 AM, priyank pulumati > wrote: > >>