Deviopath › Go

Unique Values

Easy · Maps

A map[string]bool (or map[string]struct{}) records values you have already seen. Append to the result only the first time a value appears, so the original order is kept.

Write Unique(items) that returns the unique strings in first-seen order.

Next: Join with Commas