import (
"fmt"
+ "math"
"os"
"path/filepath"
"sort"
}
// Display changes
- var changes []string
- if len(resp.FileChanges) > 0 {
- changes = append(changes,
- s.formatFileChanges(resp.FileChanges))
- }
- if len(resp.PackageChanges) > 0 {
- changes = append(changes,
- s.formatPackageChanges(resp.PackageChanges))
- }
- if len(resp.ServiceChanges) > 0 {
- changes = append(changes,
- s.formatServiceChanges(resp.ServiceChanges))
- }
- if len(resp.CommandChanges) > 0 {
- changes = append(changes,
- s.formatCommandChanges(resp.CommandChanges))
- }
- if len(changes) > 0 {
- s.logf(safcm.LogInfo, true, "%s",
- "\n"+strings.Join(changes, "\n"))
+ changes := s.formatChanges(resp)
+ if changes != "" {
+ s.logf(safcm.LogInfo, true, "%s", changes)
}
if resp.Error != "" {
allFiles := make(map[string]*safcm.File)
allPackagesMap := make(map[string]bool) // map to deduplicate
allServicesMap := make(map[string]bool) // map to deduplicate
- var allCommands []string
+ var allCommands []*safcm.Command
for _, group := range groups {
// Skip non-existent group directories
// Early entries have higher priorities
groupPriority := make(map[string]int)
for i, x := range s.config.GroupOrder {
- groupPriority[x] = i + 1
+ groupPriority[x] = math.MinInt32 + i + 1
}
// Host itself always has highest priority
- groupPriority[s.host.Name] = -1
+ groupPriority[s.host.Name] = math.MinInt32
// Sort groups after priority and name
sort.Slice(groups, func(i, j int) bool {