using context and waitgroup to controll goroutine
packagemainimport("context""flag""fmt""math/rand""os""os/signal""sync"_"time")/*context:1.controlgoroutinecasecadectx,cancel:=context.WithCancel(ctx)goA(ctx)goB(ctx)goC(ctx)defercancel()singlestopchan