I defined a variable (r.something) inside an object
func (r *Runner) init() {
r.something = make(map[string]int)
r.something["a"]=1
go r.goroutine()
}
while r.goroutine uses value stored in r.something with no synchronization. Nobody else is going to read/write this value except r.goroutine()
Is it safe to do without synchronization?
In other words: I want to reuse some variable from a goroutine initialized somewhere else before goroutine start. Is that safe?
Additional question: After r.goroutine() finishes I want to be able to use r.something from somewhere else(without read/write overlap with other goroutines). Is it safe too?