@@ -451,9 +451,9 @@ func TestPostWithTime(t *testing.T) {
451451 },
452452 }
453453
454- for tcname := range testcases {
454+ for tcname , tc := range testcases {
455+ tc := tc
455456 t .Run (tcname , func (t * testing.T ) {
456- tc := testcases [tcname ]
457457 t .Parallel ()
458458
459459 d := newTestDialer ()
@@ -506,9 +506,9 @@ func TestReconnectAndResendAfterTransientFailure(t *testing.T) {
506506 },
507507 }
508508
509- for tcname := range testcases {
509+ for tcname , tc := range testcases {
510+ tc := tc
510511 t .Run (tcname , func (t * testing.T ) {
511- tc := testcases [tcname ]
512512 t .Parallel ()
513513
514514 d := newTestDialer ()
@@ -588,9 +588,9 @@ func TestCloseOnFailingAsyncConnect(t *testing.T) {
588588 },
589589 }
590590
591- for tcname := range testcases {
591+ for tcname , tc := range testcases {
592+ tc := tc
592593 t .Run (tcname , func (t * testing.T ) {
593- tc := testcases [tcname ]
594594 t .Parallel ()
595595
596596 d := newTestDialer ()
@@ -636,22 +636,23 @@ func TestNoPanicOnAsyncClose(t *testing.T) {
636636 shouldError : false ,
637637 },
638638 }
639- for _ , testcase := range testcases {
640- t .Run (testcase .name , func (t * testing.T ) {
639+ for _ , tc := range testcases {
640+ tc := tc
641+ t .Run (tc .name , func (t * testing.T ) {
641642 t .Parallel ()
642643 d := newTestDialer ()
643- f , err := newWithDialer (testcase .config , d )
644+ f , err := newWithDialer (tc .config , d )
644645 if err != nil {
645646 t .Errorf ("Unexpected error: %v" , err )
646647 }
647- if testcase .shouldError {
648+ if tc .shouldError {
648649 f .Close ()
649650 }
650- e : = f .EncodeAndPostData ("tag_name" , time .Unix (1482493046 , 0 ), map [string ]string {"foo" : "bar" })
651- if testcase .shouldError {
652- assert .Equal (t , fmt .Errorf ("fluent#appendBuffer: Logger already closed" ), e )
651+ err = f .EncodeAndPostData ("tag_name" , time .Unix (1482493046 , 0 ), map [string ]string {"foo" : "bar" })
652+ if tc .shouldError {
653+ assert .Equal (t , fmt .Errorf ("fluent#appendBuffer: Logger already closed" ), err )
653654 } else {
654- assert .Equal (t , nil , e )
655+ assert .Equal (t , nil , err )
655656 }
656657 })
657658 }
@@ -684,9 +685,9 @@ func TestCloseOnFailingAsyncReconnect(t *testing.T) {
684685 },
685686 }
686687
687- for tcname := range testcases {
688+ for tcname , tc := range testcases {
689+ tc := tc
688690 t .Run (tcname , func (t * testing.T ) {
689- tc := testcases [tcname ]
690691 t .Parallel ()
691692
692693 d := newTestDialer ()
0 commit comments