modernize: Use strings.Builder instead of string concatenation

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-12-15 18:28:50 +01:00
parent 62ed24a87c
commit 71fd582aa2
8 changed files with 37 additions and 30 deletions

View File

@@ -16,19 +16,20 @@ func printArgs(args []fnArg) string {
}
func buildImports(specs []importSpec) string {
imports := `
var imports strings.Builder
imports.WriteString(`
import(
"errors"
"time"
"github.com/moby/moby/v2/pkg/plugins"
`
`)
for _, i := range specs {
imports += "\t" + i.String() + "\n"
imports.WriteString("\t" + i.String() + "\n")
}
imports += `)
`
return imports
imports.WriteString(`)
`)
return imports.String()
}
func marshalType(t string) string {