diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-08 08:45:37 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-08 08:45:37 +0900 |
| commit | 863e6f5db6f14d9b881427fb4fb2ceeaa0e8e4ee (patch) | |
| tree | 8fac4b40a78b724b7190fbcc1df0a6a335ed2e3b /internal/pkg/exec.go | |
| parent | 23df2ab9997dde216875c6139c8301aae93ab973 (diff) | |
internal/pkg: use correct artifact count
This updates buffer sizes and counters to use correct total artifact count.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/exec.go')
| -rw-r--r-- | internal/pkg/exec.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go index 29753952..1ace5991 100644 --- a/internal/pkg/exec.go +++ b/internal/pkg/exec.go @@ -224,6 +224,11 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) { paths[i].src = make([]*check.Absolute, len(p.A)) } + var artifactCount int + for _, p := range a.paths { + artifactCount += len(p.A) + } + if len(paths) > 0 { type cureArtifact struct { // Index of pending Artifact in paths. @@ -231,7 +236,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) { // Pending artifact. a Artifact } - ac := make(chan cureArtifact, len(paths)) + ac := make(chan cureArtifact, artifactCount) for i, p := range a.paths { for j, d := range p.A { ac <- cureArtifact{[2]int{i, j}, d} @@ -265,7 +270,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) { } var count int - errs := make([]error, 0, len(paths)) + errs := make([]error, 0, artifactCount) for cr := range res { count++ @@ -275,7 +280,7 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) { paths[cr.index[0]].src[cr.index[1]] = cr.pathname } - if count == len(paths) { + if count == artifactCount { break } } |
