Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
saylisteins
· 2y ago · 0 comments
Will this work across different goroutines?
Comments
[–]
val_deleplace
2y ago
I tested with many concurrent goroutines, and confirmed that calling `unique.Make` does not cause any data race condition
[–]
saylisteins
OP
2y ago
Thanks a lot! I also found this blog post where they mention it's thread safe thanks to using HashTrieMap internally
Link:
https://go.dev/blog/unique
[–]
val_deleplace
2y ago
We agreed to make the threadsafeness more explicit in the documentation of the 'unique' package:
https://github.com/golang/go/issues/69637
[–]
val_deleplace
2y ago
Yes, the package is designed to be thread-safe