@Tamás Gulácsi: thank you for your review. @Daniel K: yes, it was my original idea, but I quickly discarded it, because I can't guarantee that LineAppender is safe for concurrent usage. If you give it a wrong io.WriteCloser, it will be unsafe to use concurrently.
Le mercredi 6 juillet 2016 12:49:24 UTC+2, Daniel K a écrit : > > 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.