@@ -232,8 +232,7 @@ func (s *Service) constructContainers(ctx context.Context, count int) ([]*contai
232232 return nil , err
233233 }
234234
235- // FIXME(vdemeester) use property/method instead
236- id , _ := c .ID ()
235+ id := c .ID ()
237236 logrus .Debugf ("Created container %s: %v" , id , c .Name ())
238237
239238 result = append (result , c )
@@ -380,8 +379,7 @@ func (s *Service) connectContainerToNetworks(ctx context.Context, c *container.C
380379 // FIXME(vdemeester) implement alias checking (to not disconnect/reconnect for nothing)
381380 aliasPresent := false
382381 for _ , alias := range existingNetwork .Aliases {
383- // FIXME(vdemeester) use shortID instead of ID
384- ID , _ := c .ID ()
382+ ID := c .ShortID ()
385383 if alias == ID {
386384 aliasPresent = true
387385 }
@@ -403,15 +401,15 @@ func (s *Service) connectContainerToNetworks(ctx context.Context, c *container.C
403401
404402// NetworkDisconnect disconnects the container from the specified network
405403func (s * Service ) NetworkDisconnect (ctx context.Context , c * container.Container , net * yaml.Network , oneOff bool ) error {
406- containerID , _ := c .ID ()
404+ containerID := c .ID ()
407405 client := s .clientFactory .Create (s )
408406 return client .NetworkDisconnect (ctx , net .RealName , containerID , true )
409407}
410408
411409// NetworkConnect connects the container to the specified network
412410// FIXME(vdemeester) will be refactor with Container refactoring
413411func (s * Service ) NetworkConnect (ctx context.Context , c * container.Container , net * yaml.Network , oneOff bool ) error {
414- containerID , _ := c .ID ()
412+ containerID := c .ID ()
415413 client := s .clientFactory .Create (s )
416414 internalLinks , err := s .getLinks ()
417415 if err != nil {
@@ -469,7 +467,7 @@ func (s *Service) recreateIfNeeded(ctx context.Context, c *container.Container,
469467
470468func (s * Service ) recreate (ctx context.Context , c * container.Container ) (* container.Container , error ) {
471469 name := c .Name ()
472- id , _ := c .ID ()
470+ id := c .ID ()
473471 newName := fmt .Sprintf ("%s_%s" , name , id [:12 ])
474472 logrus .Debugf ("Renaming %s => %s" , name , newName )
475473 if err := c .Rename (ctx , newName ); err != nil {
@@ -481,7 +479,7 @@ func (s *Service) recreate(ctx context.Context, c *container.Container) (*contai
481479 if err != nil {
482480 return nil , err
483481 }
484- newID , _ := newContainer .ID ()
482+ newID := newContainer .ID ()
485483 logrus .Debugf ("Created replacement container %s" , newID )
486484 if err := c .Remove (ctx , false ); err != nil {
487485 logrus .Errorf ("Failed to remove old container %s" , c .Name ())
@@ -566,7 +564,7 @@ func (s *Service) Kill(ctx context.Context, signal string) error {
566564// Delete implements Service.Delete. It removes any containers related to the service.
567565func (s * Service ) Delete (ctx context.Context , options options.Delete ) error {
568566 return s .collectContainersAndDo (ctx , func (c * container.Container ) error {
569- running , _ := c .IsRunning (ctx )
567+ running := c .IsRunning (ctx )
570568 if ! running || options .RemoveRunning {
571569 return c .Remove (ctx , options .RemoveVolume )
572570 }
0 commit comments