Browse code

Don't pass reference to mutable slice

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Brian Goff authored on 2017/03/28 10:23:06
Showing 1 changed files
... ...
@@ -98,7 +98,12 @@ func (r *Registrar) GetNames(key string) ([]string, error) {
98 98
 	if !exists {
99 99
 		return nil, ErrNoSuchKey
100 100
 	}
101
-	return names, nil
101
+
102
+	ls := make([]string, 0, len(names))
103
+	for _, n := range names {
104
+		ls = append(ls, n)
105
+	}
106
+	return ls, nil
102 107
 }
103 108
 
104 109
 // Get returns the key that the passed in name is reserved to