Looks good, but you could take advantage of the io writer interface. I made a quick example, not sure if it runs (did not test)
https://play.golang.org/p/cYcz2ktoiG Den onsdag den 6. juli 2016 kl. 11.44.33 UTC+2 skrev Pierre Durand: > > My solution: https://play.golang.org/p/f5H0svLFE0 > What do you think ? > > Le mardi 5 juillet 2016 15:30:38 UTC+2, Jan Mercl a écrit : >> >> >> On Tue, Jul 5, 2016 at 11:38 AM Pierre Durand <pierre...@gmail.com> >> wrote: >> >> > It works as expected, but in my real code, I'd prefer to avoid mutex. >> >> Sounds like a case for using a writer goroutine and sending it the >> should-be-atomic log items via a chan string or chan []byte. >> >> >> >> -- >> >> -j >> > -- 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.