bugfix: When the fn function is executed, causing panic will cause the key to remain permanently. This leads to a series of problems.

Author: liqingqiyaCreated May 21, 2020Updated May 21, 2020

When the fn function is executed, causing panic will cause the key to remain permanently. This leads to a series of problems.

goroutine 1

	Group.Do 
		// add 
		g.m[key] = c

		// execute fn()
		c.val, c.err = fn()  // panic;

		// delete key
		delete(g.m, key)

goroutine 2

	Group.Do 
		// lookup  
		if c, ok := g.m[key]; ok {
			g.mu.Unlock()
			c.wg.Wait()			// wait forever
			return