fix: use strings.HasPrefix instead of manual slice comparison
- Replace entry.Name()[:len(prefix)] == prefix with strings.HasPrefix - Applied consistently in both deploy.go and export_test.go
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -715,7 +716,7 @@ func (svc *Service) cleanupCancelledDeploy(
|
||||
prefix := fmt.Sprintf("%d-", deployment.ID)
|
||||
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() && len(entry.Name()) > len(prefix) && entry.Name()[:len(prefix)] == prefix {
|
||||
if entry.IsDir() && strings.HasPrefix(entry.Name(), prefix) {
|
||||
dirPath := filepath.Join(buildDir, entry.Name())
|
||||
|
||||
removeErr := os.RemoveAll(dirPath)
|
||||
|
||||
Reference in New Issue
Block a user