Reputation: 3241
I'm stuck in a situation and cannot figure out what I messed up. Easiest way to explain is probably some minimal example: http://play.golang.org/p/14lbOBsCCo
I am tying to modify a value of a struct via its pointer but end up modifing some memory other the part I want. Line 92 is where my issue is.
How would you debug a situation like this (tools etc.), and how do I get the broker.Port set?
Thanks for hints/suggestions!
Upvotes: 2
Views: 601
Reputation: 109475
You're not using pointers throughout. Start off with a Registry of type:
type Registry []*Broker
and work from there
As far as debugging tricks, this was my process:
[]Broker
, but we want to modify Brokers, so it needs to be a pointertype Registry
to []*Broker
Upvotes: 6