Use `LabeledVolume` interface type instead of manual interface.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -589,18 +589,12 @@ func (daemon *Daemon) filterVolumes(vols []volume.Volume, filter filters.Args) ( |
| 589 | 589 |
} |
| 590 | 590 |
} |
| 591 | 591 |
if filter.Include("label") {
|
| 592 |
- v, err := daemon.volumes.Get(vol.Name()) |
|
| 593 |
- if err != nil {
|
|
| 594 |
- return nil, err |
|
| 592 |
+ v, ok := vol.(volume.LabeledVolume) |
|
| 593 |
+ if !ok {
|
|
| 594 |
+ continue |
|
| 595 | 595 |
} |
| 596 |
- if v, ok := v.(interface {
|
|
| 597 |
- Labels() map[string]string |
|
| 598 |
- }); ok {
|
|
| 599 |
- labels := v.Labels() |
|
| 600 |
- |
|
| 601 |
- if !filter.MatchKVList("label", labels) {
|
|
| 602 |
- continue |
|
| 603 |
- } |
|
| 596 |
+ if !filter.MatchKVList("label", v.Labels()) {
|
|
| 597 |
+ continue |
|
| 604 | 598 |
} |
| 605 | 599 |
} |
| 606 | 600 |
retVols = append(retVols, vol) |