From 1fa853befe94f4ddacfa18a203d122e84dad4a15 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 7 Jul 2015 22:15:07 +0100 Subject: [PATCH] Neater implementation of de-duplication in MakeIDList() --- report/id_list.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/report/id_list.go b/report/id_list.go index 6fd9596e1..c98ce509b 100644 --- a/report/id_list.go +++ b/report/id_list.go @@ -8,11 +8,12 @@ type IDList []string // MakeIDList makes a new IDList. func MakeIDList(ids ...string) IDList { sort.Strings(ids) - for i := 1; i < len(ids); i++ { // shuffle down any duplicates + for i := 1; i < len(ids); { // shuffle down any duplicates if ids[i-1] == ids[i] { ids = append(ids[:i-1], ids[i:]...) - i-- + continue } + i++ } return IDList(ids) }