range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
648 */
649 }
650
651 for _, tc := range tests { 652 test := tc
653 t.Run(test.name, func(tt *testing.T) {
654 tt.Parallel()
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
539 }
540
541 for _, tc := range tests {
542 test := tc 543 t.Run(test.name, func(tt *testing.T) {
544 tt.Parallel()
545 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
538 */
539 }
540
541 for _, tc := range tests { 542 test := tc
543 t.Run(test.name, func(tt *testing.T) {
544 tt.Parallel()
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
445 }
446 v := &vqueue{
447 il: test.fields.il,
448 dl: test.fields.dl, 449 ic: test.fields.ic,
450 dc: test.fields.dc,
451 }
range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
201 */
202 }
203
204 for _, tc := range tests { 205 test := tc
206 t.Run(test.name, func(tt *testing.T) {
207 tt.Parallel()
range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
870 */
871 }
872
873 for _, tc := range tests { 874 test := tc
875 t.Run(test.name, func(tt *testing.T) {
876 tt.Parallel()
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
217 checkFunc = defaultCheckFunc
218 }
219 v := &vqueue{
220 il: test.fields.il, 221 dl: test.fields.dl,
222 ic: test.fields.ic,
223 dc: test.fields.dc,
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
218 }
219 v := &vqueue{
220 il: test.fields.il,
221 dl: test.fields.dl, 222 ic: test.fields.ic,
223 dc: test.fields.dc,
224 }
range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
314 */
315 }
316
317 for _, tc := range tests { 318 test := tc
319 t.Run(test.name, func(tt *testing.T) {
320 tt.Parallel()
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
315 }
316
317 for _, tc := range tests {
318 test := tc 319 t.Run(test.name, func(tt *testing.T) {
320 tt.Parallel()
321 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
330 checkFunc = defaultCheckFunc
331 }
332 v := &vqueue{
333 il: test.fields.il, 334 dl: test.fields.dl,
335 ic: test.fields.ic,
336 dc: test.fields.dc,
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
331 }
332 v := &vqueue{
333 il: test.fields.il,
334 dl: test.fields.dl, 335 ic: test.fields.ic,
336 dc: test.fields.dc,
337 }
range var tc copies lock: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
428 */
429 }
430
431 for _, tc := range tests { 432 test := tc
433 t.Run(test.name, func(tt *testing.T) {
434 tt.Parallel()
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
429 }
430
431 for _, tc := range tests {
432 test := tc 433 t.Run(test.name, func(tt *testing.T) {
434 tt.Parallel()
435 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
444 checkFunc = defaultCheckFunc
445 }
446 v := &vqueue{
447 il: test.fields.il, 448 dl: test.fields.dl,
449 ic: test.fields.ic,
450 dc: test.fields.dc,
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
555 }
556 v := &vqueue{
557 il: test.fields.il,
558 dl: test.fields.dl, 559 ic: test.fields.ic,
560 dc: test.fields.dc,
561 }
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
649 }
650
651 for _, tc := range tests {
652 test := tc 653 t.Run(test.name, func(tt *testing.T) {
654 tt.Parallel()
655 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
664 checkFunc = defaultCheckFunc
665 }
666 v := &vqueue{
667 il: test.fields.il, 668 dl: test.fields.dl,
669 ic: test.fields.ic,
670 dc: test.fields.dc,
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
665 }
666 v := &vqueue{
667 il: test.fields.il,
668 dl: test.fields.dl, 669 ic: test.fields.ic,
670 dc: test.fields.dc,
671 }
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
760 }
761
762 for _, tc := range tests {
763 test := tc 764 t.Run(test.name, func(tt *testing.T) {
765 tt.Parallel()
766 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
775 checkFunc = defaultCheckFunc
776 }
777 v := &vqueue{
778 il: test.fields.il, 779 dl: test.fields.dl,
780 ic: test.fields.ic,
781 dc: test.fields.dc,
literal copies lock value from test.fields.dl: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
776 }
777 v := &vqueue{
778 il: test.fields.il,
779 dl: test.fields.dl, 780 ic: test.fields.ic,
781 dc: test.fields.dc,
782 }
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
871 }
872
873 for _, tc := range tests {
874 test := tc 875 t.Run(test.name, func(tt *testing.T) {
876 tt.Parallel()
877 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
literal copies lock value from test.fields.il: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
886 checkFunc = defaultCheckFunc
887 }
888 v := &vqueue{
889 il: test.fields.il, 890 dl: test.fields.dl,
891 ic: test.fields.ic,
892 dc: test.fields.dc,
assignment copies lock value to test: github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.test contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.fields contains github.com/vdaas/vald/pkg/agent/core/ngt/service/vqueue.indexMap contains sync.Mutex
202 }
203
204 for _, tc := range tests {
205 test := tc 206 t.Run(test.name, func(tt *testing.T) {
207 tt.Parallel()
208 defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
Description
Inadvertently copying a value containing a lock, such as sync.Mutex or sync.WaitGroup, may cause both copies to malfunction. Generally such values should be referred to through a pointer.
For example,
var x *sync.Mutex
p := x
var y sync.Mutex
p = &y
*p = *x
is not recommended because it copies the lock value.