In my journey to better my development skills I’ve been trying to write some small Go applications. I needed a sorter like uniq but on a Windows machine for a project I was doing. So I decided to write one.

Unlike uniq the input does not need sorted beforehand. The program takes either stdin or can read from a file which is passed as the first argument.

inputs
  • stdin
  • file
1
echo "test thing test thing other" | goniq

Iterating over 466,544 words, it took 2.1 seconds, vs uniq which took 3.378. Not sure if these statistics really mean anything, but it’s nice to see it’s on par with the default OS tools.

goniq

The source is here.