I defined a variable (r.something) inside the object
func (r *Runner) init() { r.something = make(map[string]int) r.something["a"]=1 go r.goroutine() }
while r.goroutine uses the value stored in r.something without synchronization. No one 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 goroutine initialized somewhere else before goroutine started. It is safe?
Additional question: After completing r.goroutine (), I want to use r.something from another place (without overlapping read / write with other goroutines). Is it safe too?
source share