don't need the top-level waitgroup

This commit is contained in:
David 2021-12-12 13:07:36 -05:00
parent c2a087abf7
commit 137cfd379b

View File

@ -108,13 +108,7 @@ func partOne() {
rooms[p[1]] = b
}
successes := make(chan bool, 10000)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
descend(rooms, "start", []string{}, successes, false)
}()
wg.Wait()
descend(rooms, "start", []string{}, successes, false)
fmt.Printf("%+v\n", len(successes))
}
func partTwo() {
@ -140,12 +134,6 @@ func partTwo() {
rooms[p[1]] = b
}
successes := make(chan bool, 200000)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
descend(rooms, "start", []string{}, successes, true)
}()
wg.Wait()
descend(rooms, "start", []string{}, successes, true)
fmt.Printf("%+v\n", len(successes))
}