File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,16 @@ type Controller struct {
3030func (cc Controller ) ExecuteCreate () {
3131 switch cc .createType {
3232 case typeUsers :
33- cc .configuration .Main .Users = append (cc .configuration .Main .Users , cc .createContent )
33+ cc .configuration .Main .Users = utils .RemoveDuplicate (
34+ append (cc .configuration .Main .Users , cc .createContent ))
3435 cc .updateConfig ()
3536 case typePorts :
36- cc .configuration .Main .Ports = append (cc .configuration .Main .Ports , cc .createContent )
37+ cc .configuration .Main .Ports = utils .RemoveDuplicate (
38+ append (cc .configuration .Main .Ports , cc .createContent ))
3739 cc .updateConfig ()
3840 case typePasswords :
39- cc .configuration .Main .Passwords = append (cc .configuration .Main .Passwords , cc .createContent )
41+ cc .configuration .Main .Passwords = utils .RemoveDuplicate (
42+ append (cc .configuration .Main .Passwords , cc .createContent ))
4043 cc .updateConfig ()
4144 case typeCaches :
4245 cc .createCaches ()
Original file line number Diff line number Diff line change @@ -23,3 +23,16 @@ func InterfaceSlice(slice interface{}) []interface{} {
2323
2424 return ret
2525}
26+
27+ func RemoveDuplicate (s []string ) []string {
28+ result := make ([]string , 0 , len (s ))
29+ temp := map [string ]bool {}
30+
31+ for _ , v := range s {
32+ if ! temp [v ] {
33+ temp [v ] = true
34+ result = append (result , v )
35+ }
36+ }
37+ return result
38+ }
You can’t perform that action at this time.
0 commit comments