From f17689c0af2e94eaf64079399325ceaf7f553b2a Mon Sep 17 00:00:00 2001 From: cui fliter Date: Thu, 3 Oct 2024 14:53:12 +0800 Subject: [PATCH] fix: fix slice init length --- server/datastore/mysql/software.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/datastore/mysql/software.go b/server/datastore/mysql/software.go index 1c112c07c0a7..ff9315eb1695 100644 --- a/server/datastore/mysql/software.go +++ b/server/datastore/mysql/software.go @@ -683,7 +683,7 @@ func (ds *Datastore) insertNewInstalledHostSoftwareDB( // INSERT IGNORE is used to avoid duplicate key errors, which may occur since our previous read came from the replica. titlesStmt := fmt.Sprintf("INSERT IGNORE INTO software_titles (name, source, browser, bundle_identifier) VALUES %s", titlesValues) titlesArgs := make([]interface{}, 0, totalTitlesToProcess*numberOfArgsPerSoftwareTitles) - titleChecksums := make([]string, totalTitlesToProcess) + titleChecksums := make([]string, 0, totalTitlesToProcess) for checksum, title := range newTitlesNeeded { titlesArgs = append(titlesArgs, title.Name, title.Source, title.Browser, title.BundleIdentifier) titleChecksums = append(titleChecksums, checksum)