Skip to content

Commit

Permalink
fix: fix slice init length
Browse files Browse the repository at this point in the history
  • Loading branch information
cuishuang authored Oct 3, 2024
1 parent 7bf4499 commit 040063a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/server/network/ovn/ovn_icsb_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (o *ICSB) GetGateways(ctx context.Context, name string) ([]string, error) {
}

// Extract the names.
names := make([]string, len(gateways))
names := make([]string, 0, len(gateways))
for _, entry := range gateways {
names = append(names, entry.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/storage/drivers/driver_ceph_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ func (d *ceph) ListVolumes() ([]Volume, error) {
return nil, fmt.Errorf("Failed getting volume list: %v: %w", strings.TrimSpace(string(errMsg)), err)
}

volList := make([]Volume, len(vols))
volList := make([]Volume, 0, len(vols))
for _, v := range vols {
volList = append(volList, v)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/storage/drivers/driver_lvm_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (d *lvm) ListVolumes() ([]Volume, error) {
return nil, fmt.Errorf("Failed getting volume list: %v: %w", strings.TrimSpace(string(errMsg)), err)
}

volList := make([]Volume, len(vols))
volList := make([]Volume, 0, len(vols))
for _, v := range vols {
volList = append(volList, v)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/storage/drivers/driver_zfs_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ func (d *zfs) ListVolumes() ([]Volume, error) {
return nil, fmt.Errorf("Failed getting volume list: %v: %w", strings.TrimSpace(string(errMsg)), err)
}

volList := make([]Volume, len(vols))
volList := make([]Volume, 0, len(vols))
for _, v := range vols {
volList = append(volList, v)
}
Expand Down

0 comments on commit 040063a

Please sign in to comment.