Преглед на файлове

make code simpler

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof преди 1 година
родител
ревизия
c525373acb
променени са 1 файла, в които са добавени 1 реда и са изтрити 7 реда
  1. 1 7
      pkg/compose/containers.go

+ 1 - 7
pkg/compose/containers.go

@@ -127,13 +127,7 @@ func isNotService(services ...string) containerPredicate {
 
 // isOrphaned is a predicate to select containers without a matching service definition in compose project
 func isOrphaned(project *types.Project) containerPredicate {
-	var services []string
-	for _, s := range project.Services {
-		services = append(services, s.Name)
-	}
-	for _, s := range project.DisabledServices {
-		services = append(services, s.Name)
-	}
+	services := append(project.ServiceNames(), project.DisabledServiceNames()...)
 	return func(c moby.Container) bool {
 		service := c.Labels[api.ServiceLabel]
 		return !utils.StringContains(services, service)