Given this declaration
type globalOptions struct {
    ...
    ccv             *ccvxml.CCV
    funcMap         template.FuncMap
}

Why this does not compile

//Initialize template functions
func newGlobalOptions() *globalOptions {
    g := globalOptions{
        ccv:     ccvxml.New(),
        funcMap: template.FuncMap{"List": g.ccv.List}, 
//List: shortcut for ccv.List
    }
    return &g
}


Whereas this compiles
func newGlobalOptions() *globalOptions {
    g := globalOptions{
        ccv: ccvxml.New(),
    }
    g.funcMap = template.FuncMap{"List": g.ccv.List} 
//List: shortcut for ccv.List
    return &g
}


Any cleaner way of achieving what I want which is to initialize two members 
of a struct referencing the first in the second member initialization?

Cheers,

-- 
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 it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to