Thanks. Axel Wagner <axel.wagner...@googlemail.com> 于 2020年5月14日周四 04:13写道:
> I'm afraid I don't understand the question. I guess you are referring to > this PR? > https://github.com/mylukin/easy-i18n/pull/2/files > It seems wrong in multiple ways (for starters, they change the module > path), but it also seems outdated; you have put several commits on master > since then. > From a casual glance at your code there is at least one race-condition: > While SetLang is protected by a mutex, none of the other methods of Printer > are. So calling SetLang concurrently with any other method will create a > data-race. > Apart from that the PR changes the API quite a bit and the "memory leak" > they talk about seems to be something they introduce themselves in the > first commit by using a global map and not provide a way to remove an > element from it - and then they fix that in the second commit by adding a > new function. > > Overall, I'm afraid to provide help, there needs to be a clear question > though. If you are indeed wondering about the PR, I think the best way to > address that would be to ask the author; it's their change and it's fine to > ask for clarification of what they are trying to achieve before accepting > it. > > On Wed, May 13, 2020 at 5:59 PM <mylu...@gmail.com> wrote: > >> I have just used golang for a month and I am not very familiar with this >> on. >> >> SetLang is not thread safe and memory leak? >> >> https://github.com/mylukin/easy-i18n/blob/master/i18n/i18n.go#L43 >> >> Please expert guidance, and how to fix it? >> >> -- >> 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. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/3f7cafe7-1ca3-499f-8819-905fd2e9eaa3%40googlegroups.com >> . >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABujZfO8EjRq4TpHFC8FartwYRbyAZzVwhV_UV%3D3FBBY8t33Sg%40mail.gmail.com.