With your (imho incorrect) code, the following small modification defers starting the channel until an add has been called and passes the test:
https://play.golang.org/p/sEFcwcPMdHF On Sunday, 5 May 2019 11:54:40 UTC+2, Jan Mercl wrote: > > On Sun, May 5, 2019 at 11:46 AM Louki Sumirniy > <louki.sumi...@gmail.com <javascript:>> wrote: > > > That would mean your code, which breaks this code, also breaks the rule > about never starting a goroutine without having a way to stop it. My code > only fails when the caller is also failing. > > My code does not even contain a go statement. How it can break a rule > about starting goroutines? > > By "my code" I mean lines 62 to 66 here > https://play.golang.org/p/v3OSWxTpTQY, the rest is your code. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.