pgraph: Mutex must be a pointer
This should be done the same way as the WaitGroup so that we don't panic!
This commit is contained in:
@@ -79,7 +79,8 @@ func NewGraph(name string) *Graph {
|
|||||||
Name: name,
|
Name: name,
|
||||||
Adjacency: make(map[*Vertex]map[*Vertex]*Edge),
|
Adjacency: make(map[*Vertex]map[*Vertex]*Edge),
|
||||||
state: graphStateNil,
|
state: graphStateNil,
|
||||||
// ptr b/c: "A WaitGroup must not be copied after first use."
|
// ptr b/c: Mutex/WaitGroup must not be copied after first use
|
||||||
|
mutex: &sync.Mutex{},
|
||||||
wg: &sync.WaitGroup{},
|
wg: &sync.WaitGroup{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user