Skip to content

Commit 3018234

Browse files
committed
oci: fix loop iterator aliasing
Signed-off-by: Akihiro Suda <[email protected]> (cherry picked from commit ef2560d) Signed-off-by: Akihiro Suda <[email protected]>
1 parent 0070ab7 commit 3018234

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

oci/spec_opts_linux_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ guest:x:405:100:guest:/dev/null:/sbin/nologin
6969
},
7070
}
7171
for _, testCase := range testCases {
72+
testCase := testCase
7273
t.Run(fmt.Sprintf("user %d", testCase.userID), func(t *testing.T) {
7374
t.Parallel()
7475
s := Spec{
@@ -128,6 +129,7 @@ guest:x:405:100:guest:/dev/null:/sbin/nologin
128129
},
129130
}
130131
for _, testCase := range testCases {
132+
testCase := testCase
131133
t.Run(testCase.user, func(t *testing.T) {
132134
t.Parallel()
133135
s := Spec{
@@ -177,11 +179,11 @@ sys:x:3:root,bin,adm
177179
}{
178180
{
179181
user: "root",
180-
expected: []uint32{},
182+
expected: []uint32{1, 2, 3},
181183
},
182184
{
183185
user: "1000",
184-
expected: []uint32{},
186+
expected: nil,
185187
},
186188
{
187189
user: "bin",
@@ -197,6 +199,7 @@ sys:x:3:root,bin,adm
197199
},
198200
}
199201
for _, testCase := range testCases {
202+
testCase := testCase
200203
t.Run(testCase.user, func(t *testing.T) {
201204
t.Parallel()
202205
s := Spec{
@@ -489,6 +492,7 @@ daemon:x:2:root,bin,daemon
489492
}
490493

491494
for _, testCase := range testCases {
495+
testCase := testCase
492496
t.Run(testCase.name, func(t *testing.T) {
493497
t.Parallel()
494498
s := Spec{

0 commit comments

Comments
 (0)