summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nshd/hackers_git/hackers_parse.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nshd/hackers_git/hackers_parse.go b/src/nshd/hackers_git/hackers_parse.go
index 858347e..f7baa68 100644
--- a/src/nshd/hackers_git/hackers_parse.go
+++ b/src/nshd/hackers_git/hackers_parse.go
@@ -81,19 +81,24 @@ func parse_user_yaml(filename string) (ret user, err error) {
} else if ary, isTyp := iface.([]interface{}); !isTyp {
errs = append(errs, "\"groups\" is not an array")
} else {
- groups := make([]string, len(ary))
+ groups := make(map[string]bool, len(ary))
e := false
- for i, iface := range ary {
+ for _, iface := range ary {
if str, isTyp := iface.(string); !isTyp {
errs = append(errs, "\"group\" item is not an array")
e = true
break
} else {
- groups[i] = str
+ groups[str] = true
}
}
if !e {
- ret.groups = groups
+ ret.groups = make([]string, len(groups))
+ var i uint = 0
+ for group, _ := range groups {
+ ret.groups[i] = group
+ i++
+ }
}
}
}