controller(listVMs): reduce allocations (#400)

* controller(listVMs): reduce allocations

* Declare an empty, non-nil slice to return [] when no objects are found
This commit is contained in:
Nikolay Edigaryev 2026-02-05 22:02:21 +01:00 committed by GitHub
parent be869f10d4
commit bdc2af3d58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -344,7 +344,9 @@ func (controller *Controller) listVMs(ctx *gin.Context) responder.Responder {
return responder.Code(http.StatusInternalServerError)
}
vms := make([]v1.VM, 0, len(allVMs))
// Declare an empty, non-nil slice to
// return [] when no objects are found
vms := []v1.VM{}
Outer:
for _, vm := range allVMs {