summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/volumes.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-11 14:40:38 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-06-15 07:05:56 -0400
commit200cfa41a434b7143620c2c252b3eb7ab3ef92f9 (patch)
treeccf0cb95297dc65d4dc8bd366963e2b037fb1a8b /pkg/domain/infra/abi/volumes.go
parent3f026eb6a682a68e69f9376b72157a8f084e575c (diff)
downloadpodman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.tar.gz
podman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.tar.bz2
podman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.zip
Turn on More linters
- misspell - prealloc - unparam - nakedret Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/volumes.go')
-rw-r--r--pkg/domain/infra/abi/volumes.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go
index a311e0c4e..702e11003 100644
--- a/pkg/domain/infra/abi/volumes.go
+++ b/pkg/domain/infra/abi/volumes.go
@@ -40,9 +40,10 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum
func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) {
var (
err error
- reports []*entities.VolumeRmReport
vols []*libpod.Volume
+ reports = []*entities.VolumeRmReport{}
)
+
if opts.All {
vols, err = ic.Libpod.Volumes()
if err != nil {
@@ -72,9 +73,8 @@ func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, op
func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []string, opts entities.VolumeInspectOptions) ([]*entities.VolumeInspectReport, error) {
var (
- err error
- reports []*entities.VolumeInspectReport
- vols []*libpod.Volume
+ err error
+ vols []*libpod.Volume
)
// Note: as with previous implementation, a single failure here
@@ -93,6 +93,7 @@ func (ic *ContainerEngine) VolumeInspect(ctx context.Context, namesOrIds []strin
vols = append(vols, vol)
}
}
+ reports := make([]*entities.VolumeInspectReport, 0, len(vols))
for _, v := range vols {
config := entities.VolumeConfigResponse{
Name: v.Name(),
@@ -115,13 +116,11 @@ func (ic *ContainerEngine) VolumePrune(ctx context.Context, opts entities.Volume
}
func (ic *ContainerEngine) pruneVolumesHelper(ctx context.Context) ([]*entities.VolumePruneReport, error) {
- var (
- reports []*entities.VolumePruneReport
- )
pruned, err := ic.Libpod.PruneVolumes(ctx)
if err != nil {
return nil, err
}
+ reports := make([]*entities.VolumePruneReport, 0, len(pruned))
for k, v := range pruned {
reports = append(reports, &entities.VolumePruneReport{
Err: v,
@@ -132,9 +131,6 @@ func (ic *ContainerEngine) pruneVolumesHelper(ctx context.Context) ([]*entities.
}
func (ic *ContainerEngine) VolumeList(ctx context.Context, opts entities.VolumeListOptions) ([]*entities.VolumeListReport, error) {
- var (
- reports []*entities.VolumeListReport
- )
volumeFilters, err := filters.GenerateVolumeFilters(opts.Filter)
if err != nil {
return nil, err
@@ -143,6 +139,7 @@ func (ic *ContainerEngine) VolumeList(ctx context.Context, opts entities.VolumeL
if err != nil {
return nil, err
}
+ reports := make([]*entities.VolumeListReport, 0, len(vols))
for _, v := range vols {
config := entities.VolumeConfigResponse{
Name: v.Name(),