From 59bd86a68f02cdca6c0a538ec65e770b1a689828 Mon Sep 17 00:00:00 2001 From: chuanshanjida Date: Sun, 12 Apr 2026 16:20:05 +0800 Subject: [PATCH] refactor: use strings.builder Signed-off-by: chuanshanjida --- internal/dependencymanager/dependencyinstaller.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/dependencymanager/dependencyinstaller.go b/internal/dependencymanager/dependencyinstaller.go index c1e59d889..b3c7d4c1c 100644 --- a/internal/dependencymanager/dependencyinstaller.go +++ b/internal/dependencymanager/dependencyinstaller.go @@ -24,6 +24,7 @@ import ( "encoding/hex" "fmt" "path/filepath" + "strings" "github.com/psiemens/sconfig" @@ -585,19 +586,19 @@ func (di *DependencyInstaller) fetchDependenciesWithDepth(dependency config.Depe } // Log installation with visual hierarchy and branding colors - indent := "" + var indent strings.Builder prefix := "" if depth > 0 { // Create indentation with proper tree characters for i := 0; i < depth; i++ { - indent += " " + indent.WriteString(" ") } prefix = "├─ " // Add depth limit warning for very deep chains if depth >= 5 { - di.Logger.Info(fmt.Sprintf("%s⚠️ Deep dependency chain (depth %d)", indent, depth)) + di.Logger.Info(fmt.Sprintf("%s⚠️ Deep dependency chain (depth %d)", indent.String(), depth)) } } @@ -606,7 +607,7 @@ func (di *DependencyInstaller) fetchDependenciesWithDepth(dependency config.Depe shortAddress := "0x..." + fullAddress[len(fullAddress)-4:] addressStyled := branding.GreenStyle.Render(shortAddress) networkStyled := branding.GrayStyle.Render(networkName) - di.Logger.Info(fmt.Sprintf("%s%s%s @ %s (%s)", indent, prefix, contractNameStyled, addressStyled, networkStyled)) + di.Logger.Info(fmt.Sprintf("%s%s%s @ %s (%s)", indent.String(), prefix, contractNameStyled, addressStyled, networkStyled)) di.installCount++ err := di.addDependency(dependency)