When calling String() concurrently, it goes to panic.
Is it possible to use sync.Map to avoid panic?
func (sm *StateMachine) stateRepresentation(state State) (sr *stateRepresentation) {
var ok bool
if sr, ok = sm.stateConfig[state]; !ok {
sr = newstateRepresentation(state)
sm.stateConfig[state] = sr // concurrent panic point
}
return
}
When calling
String()
concurrently, it goes to panic. Is it possible to use sync.Map to avoid panic?