I have an interface that represents a pointer to a struct object after it has been initialized. I want to get access to the Value of the object that the interface references rather than the pointer so that I can pass it by value to a function as the interface type.
Here is an example of my issue: https://play.golang.org/p/_3vKThlj-V
I want to be able to pass val by value to the function EvalTest in my main function so that I can overwrite the pointer to the TestStruct object in another thread without causing pointer dereference issues in another thread.
The problem is that I'm running several thousand go routines against my interface object, but every 50 go routine calls I have to re-initialize my pointer due to a constraint of the system I'm integrating with. This seems to be leading to an inconsistent state where the new struct initialization is not completely finished when the go routines attempt to access it again. So the reason I wanted to pass it by value was so that I don't have to worry about the pointer being swapped out.
Any thoughts on this?