Skip to content

Commit 58d3aa8

Browse files
committed
Extract filename creation logic to seperate function
1 parent 0822e6b commit 58d3aa8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/cmd/run/view/view.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,11 @@ func promptForJob(cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, er
461461
return nil, nil
462462
}
463463

464+
func createLogFilename(job shared.Job, step shared.Step) string {
465+
return fmt.Sprintf("%s/%d_%s.txt", job.Name, step.Number,
466+
strings.ReplaceAll(step.Name, "/", ""))
467+
}
468+
464469
// This function takes a zip file of logs and a list of jobs.
465470
// Structure of zip file
466471
// zip/
@@ -478,8 +483,7 @@ func promptForJob(cs *iostreams.ColorScheme, jobs []shared.Job) (*shared.Job, er
478483
func attachRunLog(rlz *zip.ReadCloser, jobs []shared.Job) {
479484
for i, job := range jobs {
480485
for j, step := range job.Steps {
481-
filename := fmt.Sprintf("%s/%d_%s.txt", job.Name, step.Number,
482-
strings.ReplaceAll(step.Name, "/", ""))
486+
filename := createLogFilename(job, step)
483487
for _, file := range rlz.File {
484488
if file.Name == filename {
485489
jobs[i].Steps[j].Log = file

0 commit comments

Comments
 (0)