@@ -215,8 +215,7 @@ func (s *Service) constructContainers(ctx context.Context, count int) ([]*contai
215215 return nil , err
216216 }
217217
218- // FIXME(vdemeester) use property/method instead
219- id , _ := c .ID ()
218+ id := c .ID ()
220219 logrus .Debugf ("Created container %s: %v" , id , c .Name ())
221220
222221 result = append (result , c )
@@ -363,8 +362,7 @@ func (s *Service) connectContainerToNetworks(ctx context.Context, c *container.C
363362 // FIXME(vdemeester) implement alias checking (to not disconnect/reconnect for nothing)
364363 aliasPresent := false
365364 for _ , alias := range existingNetwork .Aliases {
366- // FIXME(vdemeester) use shortID instead of ID
367- ID , _ := c .ID ()
365+ ID := c .ShortID ()
368366 if alias == ID {
369367 aliasPresent = true
370368 }
@@ -386,15 +384,15 @@ func (s *Service) connectContainerToNetworks(ctx context.Context, c *container.C
386384
387385// NetworkDisconnect disconnects the container from the specified network
388386func (s * Service ) NetworkDisconnect (ctx context.Context , c * container.Container , net * yaml.Network , oneOff bool ) error {
389- containerID , _ := c .ID ()
387+ containerID := c .ID ()
390388 client := s .clientFactory .Create (s )
391389 return client .NetworkDisconnect (ctx , net .RealName , containerID , true )
392390}
393391
394392// NetworkConnect connects the container to the specified network
395393// FIXME(vdemeester) will be refactor with Container refactoring
396394func (s * Service ) NetworkConnect (ctx context.Context , c * container.Container , net * yaml.Network , oneOff bool ) error {
397- containerID , _ := c .ID ()
395+ containerID := c .ID ()
398396 client := s .clientFactory .Create (s )
399397 internalLinks , err := s .getLinks ()
400398 if err != nil {
@@ -452,7 +450,7 @@ func (s *Service) recreateIfNeeded(ctx context.Context, c *container.Container,
452450
453451func (s * Service ) recreate (ctx context.Context , c * container.Container ) (* container.Container , error ) {
454452 name := c .Name ()
455- id , _ := c .ID ()
453+ id := c .ID ()
456454 newName := fmt .Sprintf ("%s_%s" , name , id [:12 ])
457455 logrus .Debugf ("Renaming %s => %s" , name , newName )
458456 if err := c .Rename (ctx , newName ); err != nil {
@@ -464,7 +462,7 @@ func (s *Service) recreate(ctx context.Context, c *container.Container) (*contai
464462 if err != nil {
465463 return nil , err
466464 }
467- newID , _ := newContainer .ID ()
465+ newID := newContainer .ID ()
468466 logrus .Debugf ("Created replacement container %s" , newID )
469467 if err := c .Remove (ctx , false ); err != nil {
470468 logrus .Errorf ("Failed to remove old container %s" , c .Name ())
@@ -549,7 +547,7 @@ func (s *Service) Kill(ctx context.Context, signal string) error {
549547// Delete implements Service.Delete. It removes any containers related to the service.
550548func (s * Service ) Delete (ctx context.Context , options options.Delete ) error {
551549 return s .collectContainersAndDo (ctx , func (c * container.Container ) error {
552- running , _ := c .IsRunning (ctx )
550+ running := c .IsRunning (ctx )
553551 if ! running || options .RemoveRunning {
554552 return c .Remove (ctx , options .RemoveVolume )
555553 }
0 commit comments