(ctx context.Context, id string)
| 259 | } |
| 260 | |
| 261 | func (s *composeService) removeVolume(ctx context.Context, id string) error { |
| 262 | resource := fmt.Sprintf("Volume %s", id) |
| 263 | |
| 264 | _, err := s.apiClient().VolumeInspect(ctx, id, client.VolumeInspectOptions{}) |
| 265 | if errdefs.IsNotFound(err) { |
| 266 | // Already gone |
| 267 | return nil |
| 268 | } |
| 269 | |
| 270 | return s.removeResource(resource, func() error { |
| 271 | _, err := s.apiClient().VolumeRemove(ctx, id, client.VolumeRemoveOptions{ |
| 272 | Force: true, |
| 273 | }) |
| 274 | return err |
| 275 | }) |
| 276 | } |
| 277 | |
| 278 | // removeResource emits a "Removing" progress event, calls op, then emits the appropriate |
| 279 | // completion event based on the error: nil→Removed, conflict→still-in-use warning, not-found→gone warning. |
no test coverage detected