apply linter recommendations

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2020-11-19 17:35:34 +01:00
parent e7284e76e9
commit eeb09d9e80
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
3 changed files with 10 additions and 14 deletions

View File

@ -40,7 +40,10 @@ const (
) )
func (s *local) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig) error { func (s *local) ensureService(ctx context.Context, project *types.Project, service types.ServiceConfig) error {
s.waitDependencies(ctx, project, service) err := s.waitDependencies(ctx, project, service)
if err != nil {
return err
}
actual, err := s.containerService.apiClient.ContainerList(ctx, moby.ContainerListOptions{ actual, err := s.containerService.apiClient.ContainerList(ctx, moby.ContainerListOptions{
Filters: filters.NewArgs( Filters: filters.NewArgs(
@ -117,7 +120,10 @@ func (s *local) waitDependencies(ctx context.Context, project *types.Project, se
switch config.Condition { switch config.Condition {
case "service_healthy": case "service_healthy":
eg.Go(func() error { eg.Go(func() error {
for range time.Tick(500 * time.Millisecond) { ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
for {
<-ticker.C
healthy, err := s.isServiceHealthy(ctx, project, dep) healthy, err := s.isServiceHealthy(ctx, project, dep)
if err != nil { if err != nil {
return err return err
@ -126,7 +132,6 @@ func (s *local) waitDependencies(ctx context.Context, project *types.Project, se
return nil return nil
} }
} }
return nil
}) })
} }
} }

View File

@ -62,9 +62,9 @@ type node struct {
dependent []string dependent []string
} }
func (d dependencyGraph) independents() []node { func (graph dependencyGraph) independents() []node {
var nodes []node var nodes []node
for _, node := range d { for _, node := range graph {
if len(node.dependencies) == 0 { if len(node.dependencies) == 0 {
nodes = append(nodes, node) nodes = append(nodes, node)
} }

View File

@ -40,12 +40,3 @@ func contains(slice []string, item string) bool {
} }
return false return false
} }
func containsAll(slice []string, items []string) bool {
for _, i := range items {
if !contains(slice, i) {
return false
}
}
return true
}