From c183fe2035e0d00434b81fc446a8423b558de901 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 14 Jun 2026 21:40:50 +0200 Subject: [PATCH] restore: speed up test data generation in newTestRepo --- internal/restorer/filerestorer_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/restorer/filerestorer_test.go b/internal/restorer/filerestorer_test.go index adb4e9cd1..5a423ea2a 100644 --- a/internal/restorer/filerestorer_test.go +++ b/internal/restorer/filerestorer_test.go @@ -7,6 +7,7 @@ import ( "fmt" "os" "slices" + "strings" "testing" "github.com/restic/restic/internal/errors" @@ -107,9 +108,9 @@ func newTestRepo(content []TestFile) *TestRepo { filesPathToContent := make(map[string]string) for _, file := range content { - var content string + content := strings.Builder{} for _, blob := range file.blobs { - content += blob.data + content.WriteString(blob.data) // get the pack, create as necessary var pack Pack @@ -134,7 +135,7 @@ func newTestRepo(content []TestFile) *TestRepo { packs[blob.pack] = pack } - filesPathToContent[file.name] = content + filesPathToContent[file.name] = content.String() } blobs := make(map[restic.ID][]restic.PackBlob)