From f69ac8819bcbe652ca492928aac0e6e39f8af62f Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Thu, 5 Feb 2026 21:55:09 +0100 Subject: [PATCH] Declare an empty, non-nil slice to return [] when no objects are found --- internal/controller/api_vms.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/controller/api_vms.go b/internal/controller/api_vms.go index 6134714..5c7a387 100644 --- a/internal/controller/api_vms.go +++ b/internal/controller/api_vms.go @@ -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 {