Well, any specific reason for not making Proxy its own structure?
In any case, you have 2 options:
The correct way is to simply move the proxy into your own structure, for example:
type Configuration struct { Val string Proxy } type Proxy struct { Address string Port string } func main() { c := &Configuration{ Val: "test", Proxy: Proxy{ Address: "addr", Port: "port", }, } fmt.Println(c) }
Less correct and ugly way, but still works:
c := &Configuration{ Val: "test", Proxy: struct { Address string Port string }{ Address: "addr", Port: "80", }, }
OneOfOne Jul 17 '14 at 16:56 2014-07-17 16:56
source share