Too Long; Didn't Read
Golang is a great language with a rich standard library, but it still has some useful functions. Let’s imagine that there is a need to write a function that makes the user IDs slice unique. This approach covers your needs if you have problems with performance and can mutate the input slice. We sort the slice and then iterate through it via 2 iterators: unique iterator and the usual. After all iterations, we return the subslice up to a unique iterator.
Share Your Thoughts