From 3daa798e14aab8a577efb2813ec40ab6f166f9ec Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 25 Aug 2015 06:52:56 +0100 Subject: [PATCH] Small tweak, next cleanup the tests --- sanitize.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sanitize.go b/sanitize.go index 93545e94..fd83e4c7 100644 --- a/sanitize.go +++ b/sanitize.go @@ -1,10 +1,11 @@ package dns // Dedup removes identical RRs from rrs. It preserves the original ordering. +// The lowest TTL of any duplicates is used in the remaining one. // TODO(miek): CNAME, DNAME 'n stuff. func Dedup(rrs []RR) []RR { m := make(map[string]RR) - keys := []string{} + keys := make([]string, 0, len(rrs)) for _, r := range rrs { key := normalizedString(r) @@ -19,8 +20,7 @@ func Dedup(rrs []RR) []RR { m[key] = r } // If the length of the result map equals the amount of RRs we got, - // it means they were all different. We can then just return the original - // rrset. + // it means they were all different. We can then just return the original rrset. if len(m) == len(rrs) { return rrs }