Declare an empty, non-nil slice to return [] when no objects are found

This commit is contained in:
Nikolay Edigaryev 2026-02-05 21:55:09 +01:00
parent 8aae1aa57a
commit f69ac8819b
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)
}
var vms []v1.VM
// Declare an empty, non-nil slice to
// return [] when no objects are found
vms := []v1.VM{}
Outer:
for _, vm := range allVMs {