From 14c7fc52640be178caa708a26af5e8719c14fbf1 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Tue, 11 Jun 2024 08:55:07 -0400 Subject: [PATCH] Fix code linting issue where a slice was created non-empty and appended-to (#19490) --- changes/19290-fix-make-slice-with-capacity | 1 + server/datastore/mysql/microsoft_mdm.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changes/19290-fix-make-slice-with-capacity diff --git a/changes/19290-fix-make-slice-with-capacity b/changes/19290-fix-make-slice-with-capacity new file mode 100644 index 000000000000..27770b1bfe42 --- /dev/null +++ b/changes/19290-fix-make-slice-with-capacity @@ -0,0 +1 @@ +* Fixed a code linter issue where a slice was created non-empty and appended-to, instead of empty with the required capacity. diff --git a/server/datastore/mysql/microsoft_mdm.go b/server/datastore/mysql/microsoft_mdm.go index 15c2b1c1421a..f8035b1bd2ec 100644 --- a/server/datastore/mysql/microsoft_mdm.go +++ b/server/datastore/mysql/microsoft_mdm.go @@ -416,7 +416,7 @@ func updateMDMWindowsHostProfileStatusFromResponseDB( WHERE host_uuid = ? AND command_uuid IN (?)` // grab command UUIDs to find matching entries using `getMatchingHostProfilesStmt` - commandUUIDs := make([]string, len(payloads)) + commandUUIDs := make([]string, 0, len(payloads)) // also grab the payloads keyed by the command uuid, so we can easily // grab the corresponding `Detail` and `Status` from the matching // command later on.