]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
safcm: use better variable name in hostsToSync()
authorSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 10:47:40 +0000 (12:47 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 13:21:05 +0000 (15:21 +0200)
Having nameMatched and hostMatched is confusing. Follow the comment and
use hostAdded which describes the meaning more clearly.

cmd/safcm/sync.go

index 54df9ec6230efc8cffda0ff347960efb0317a61a..70aaf47e4c8f5c364247fa4fe0c05e239bb5d79b 100644 (file)
@@ -247,13 +247,13 @@ are only available after the hosts were contacted.
        nameMatched := make(map[string]bool)
        // To detect typos we must check all given names but one host can be
        // matched by multiple names (e.g. two groups with overlapping hosts)
-       hostMatched := make(map[string]bool)
+       hostAdded := make(map[string]bool)
 
        var res []*config.Host
        for _, host := range allHosts.List {
                if nameMap[host.Name] {
                        res = append(res, host)
-                       hostMatched[host.Name] = true
+                       hostAdded[host.Name] = true
                        nameMatched[host.Name] = true
                }
 
@@ -264,9 +264,9 @@ are only available after the hosts were contacted.
                }
                for _, x := range groups {
                        if nameMap[x] {
-                               if !hostMatched[host.Name] {
+                               if !hostAdded[host.Name] {
                                        res = append(res, host)
-                                       hostMatched[host.Name] = true
+                                       hostAdded[host.Name] = true
                                }
                                nameMatched[x] = true
                        }