mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
modernize: Use strings.Builder instead of string concatenation
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/v2/pkg/tracing"
|
||||
"github.com/containerd/log"
|
||||
@@ -78,7 +79,7 @@ func (l *tarexporter) Load(ctx context.Context, inTar io.ReadCloser, outStream i
|
||||
}
|
||||
|
||||
var parentLinks []parentLink
|
||||
var imageIDsStr string
|
||||
var imageIDsStr strings.Builder
|
||||
var imageRefCount int
|
||||
|
||||
for _, m := range manifest {
|
||||
@@ -142,7 +143,7 @@ func (l *tarexporter) Load(ctx context.Context, inTar io.ReadCloser, outStream i
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
imageIDsStr += fmt.Sprintf("Loaded image ID: %s\n", imgID)
|
||||
imageIDsStr.WriteString(fmt.Sprintf("Loaded image ID: %s\n", imgID))
|
||||
|
||||
imageRefCount = 0
|
||||
for _, repoTag := range m.RepoTags {
|
||||
@@ -172,7 +173,7 @@ func (l *tarexporter) Load(ctx context.Context, inTar io.ReadCloser, outStream i
|
||||
}
|
||||
|
||||
if imageRefCount == 0 {
|
||||
outStream.Write([]byte(imageIDsStr))
|
||||
outStream.Write([]byte(imageIDsStr.String()))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user