Skip to content

Commit 2c2bd5c

Browse files
mrajagopalCopilot
andauthored
Update pkg/jobs/common_job_list_test.go
Taking the address of a slice element from a function call creates a pointer to a temporary value. Store the slice in a variable first, then take the address: jobs := CommonJobList(); podListJob = &jobs[i] Co-authored-by: Copilot <[email protected]>
1 parent 1922e67 commit 2c2bd5c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/jobs/common_job_list_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ func TestCommonJobList_SelectedJobsProduceFiles(t *testing.T) {
125125
func TestCommonJobList_PodListJSONKeyPresence(t *testing.T) {
126126
dc := setupDataCollector(t)
127127
var podListJob *Job
128-
for i, j := range CommonJobList() {
128+
jobs := CommonJobList()
129+
for i, j := range jobs {
129130
if j.Name == "pod-list" {
130-
podListJob = &CommonJobList()[i]
131+
podListJob = &jobs[i]
131132
break
132133
}
133134
}

0 commit comments

Comments
 (0)