diff --git a/aliasmgr/aliasmgr_test.go b/aliasmgr/aliasmgr_test.go index 3237e5bbb..cdf88423b 100644 --- a/aliasmgr/aliasmgr_test.go +++ b/aliasmgr/aliasmgr_test.go @@ -259,7 +259,6 @@ func TestGetNextScid(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { nextScid := getNextScid(test.current) require.Equal(t, test.expected, nextScid) diff --git a/amp/derivation_test.go b/amp/derivation_test.go index af8162d1d..3ebddca72 100644 --- a/amp/derivation_test.go +++ b/amp/derivation_test.go @@ -43,7 +43,6 @@ var sharerTests = []sharerTest{ // receiver, produce identical child hashes and preimages as the sender. func TestSharer(t *testing.T) { for _, test := range sharerTests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/autopilot/betweenness_centrality_test.go b/autopilot/betweenness_centrality_test.go index 5571a78d2..7e257a876 100644 --- a/autopilot/betweenness_centrality_test.go +++ b/autopilot/betweenness_centrality_test.go @@ -40,7 +40,6 @@ func TestBetweennessCentralityEmptyGraph(t *testing.T) { ) for _, chanGraph := range chanGraphs { - chanGraph := chanGraph graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") @@ -83,7 +82,6 @@ func TestBetweennessCentralityWithNonEmptyGraph(t *testing.T) { for _, numWorkers := range workers { for _, chanGraph := range chanGraphs { - chanGraph := chanGraph numWorkers := numWorkers graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") @@ -110,7 +108,6 @@ func TestBetweennessCentralityWithNonEmptyGraph(t *testing.T) { require.NoError(t1, err) for _, expected := range tests { - expected := expected centrality := metric.GetMetric( expected.normalize, ) diff --git a/autopilot/prefattach_test.go b/autopilot/prefattach_test.go index cdaec8746..9ff9d30cc 100644 --- a/autopilot/prefattach_test.go +++ b/autopilot/prefattach_test.go @@ -91,7 +91,6 @@ func TestPrefAttachmentSelectEmptyGraph(t *testing.T) { } for _, chanGraph := range chanGraphs { - chanGraph := chanGraph graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") @@ -128,7 +127,6 @@ func TestPrefAttachmentSelectTwoVertexes(t *testing.T) { ) for _, chanGraph := range chanGraphs { - chanGraph := chanGraph graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") @@ -215,7 +213,6 @@ func TestPrefAttachmentSelectGreedyAllocation(t *testing.T) { ) for _, chanGraph := range chanGraphs { - chanGraph := chanGraph graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") @@ -328,7 +325,6 @@ func TestPrefAttachmentSelectSkipNodes(t *testing.T) { ) for _, chanGraph := range chanGraphs { - chanGraph := chanGraph graph, err := chanGraph.genFunc(t) require.NoError(t, err, "unable to create graph") diff --git a/autopilot/top_centrality_test.go b/autopilot/top_centrality_test.go index 282e60c36..a6fe22727 100644 --- a/autopilot/top_centrality_test.go +++ b/autopilot/top_centrality_test.go @@ -83,7 +83,6 @@ func TestTopCentrality(t *testing.T) { } for _, chanGraph := range chanGraphs { - chanGraph := chanGraph success := t.Run(chanGraph.name, func(t1 *testing.T) { t1.Parallel() diff --git a/build/log_test.go b/build/log_test.go index dbce428e4..d58b3ddda 100644 --- a/build/log_test.go +++ b/build/log_test.go @@ -92,7 +92,6 @@ func TestParseAndSetDebugLevels(t *testing.T) { } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { m := &mockSubLogger{ subLogLevels: make(map[string]string), diff --git a/chainntnfs/txnotifier_test.go b/chainntnfs/txnotifier_test.go index 1bd9f4f1c..d06ab8ebe 100644 --- a/chainntnfs/txnotifier_test.go +++ b/chainntnfs/txnotifier_test.go @@ -172,7 +172,6 @@ func TestTxNotifierRegistrationValidation(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase success := t.Run(testCase.name, func(t *testing.T) { hintCache := newMockHintCache() n := chainntnfs.NewTxNotifier( diff --git a/chanacceptor/acceptor_test.go b/chanacceptor/acceptor_test.go index 5a6aaa012..2746b31b0 100644 --- a/chanacceptor/acceptor_test.go +++ b/chanacceptor/acceptor_test.go @@ -134,8 +134,6 @@ func (c *channelAcceptorCtx) queryAndAssert(queries map[*lnwire.OpenChannel]*Cha ) for request, expected := range queries { - request := request - expected := expected go func() { resp := c.acceptor.Accept(&ChannelAcceptRequest{ diff --git a/chanacceptor/merge_test.go b/chanacceptor/merge_test.go index c6b6579a7..0ffaadeb8 100644 --- a/chanacceptor/merge_test.go +++ b/chanacceptor/merge_test.go @@ -182,7 +182,6 @@ func TestMergeResponse(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { resp, err := mergeResponse(test.current, test.new) diff --git a/chanacceptor/rpcacceptor_test.go b/chanacceptor/rpcacceptor_test.go index de1f380c1..eb65080d5 100644 --- a/chanacceptor/rpcacceptor_test.go +++ b/chanacceptor/rpcacceptor_test.go @@ -118,7 +118,6 @@ func TestValidateAcceptorResponse(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Create an acceptor, everything can be nil because diff --git a/chanbackup/backupfile_test.go b/chanbackup/backupfile_test.go index e97d4ceba..11d66e115 100644 --- a/chanbackup/backupfile_test.go +++ b/chanbackup/backupfile_test.go @@ -431,7 +431,6 @@ func TestCreateArchiveFile(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { defer os.RemoveAll(archiveDir) if tc.setup != nil { diff --git a/chanfitness/chanevent_test.go b/chanfitness/chanevent_test.go index 43046db25..8d1cc548c 100644 --- a/chanfitness/chanevent_test.go +++ b/chanfitness/chanevent_test.go @@ -388,7 +388,6 @@ func TestGetOnlinePeriod(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -545,7 +544,6 @@ func TestUptime(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { score := &peerLog{ diff --git a/chanfitness/chaneventstore_test.go b/chanfitness/chaneventstore_test.go index ecec3ea47..f14eba1d3 100644 --- a/chanfitness/chaneventstore_test.go +++ b/chanfitness/chaneventstore_test.go @@ -57,7 +57,6 @@ func TestStartStoreError(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { clock := clock.NewTestClock(testNow) diff --git a/chanfitness/rate_limit_test.go b/chanfitness/rate_limit_test.go index b9bca8086..6e5ebf97d 100644 --- a/chanfitness/rate_limit_test.go +++ b/chanfitness/rate_limit_test.go @@ -39,7 +39,6 @@ func TestGetRateLimit(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -91,7 +90,6 @@ func TestCooldownFlapCount(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/channeldb/channel_test.go b/channeldb/channel_test.go index 7039abe46..5b8758e9a 100644 --- a/channeldb/channel_test.go +++ b/channeldb/channel_test.go @@ -566,7 +566,6 @@ func TestOptionalShutdown(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { fullDB, err := MakeTestDB(t) @@ -1325,7 +1324,6 @@ func TestShutdownInfo(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1513,7 +1511,6 @@ func TestCloseInitiator(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1634,7 +1631,6 @@ func TestHasChanStatus(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { c := &OpenChannel{ @@ -1817,7 +1813,6 @@ func TestHTLCsExtraData(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/channeldb/db_test.go b/channeldb/db_test.go index 27428a6f9..c41b8e12a 100644 --- a/channeldb/db_test.go +++ b/channeldb/db_test.go @@ -594,7 +594,6 @@ func TestFetchChannels(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/channeldb/migration/create_tlb_test.go b/channeldb/migration/create_tlb_test.go index 164e8f27f..31171651b 100644 --- a/channeldb/migration/create_tlb_test.go +++ b/channeldb/migration/create_tlb_test.go @@ -37,7 +37,6 @@ func TestCreateTLB(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { migtest.ApplyMigration( t, diff --git a/channeldb/migration12/migration_test.go b/channeldb/migration12/migration_test.go index 75d74fdd6..7baae6435 100644 --- a/channeldb/migration12/migration_test.go +++ b/channeldb/migration12/migration_test.go @@ -192,7 +192,6 @@ func genAfterMigration(afterBytes []byte) func(kvdb.RwTx) error { // final struct, but verifies that the field is properly removed. func TestTLVInvoiceMigration(t *testing.T) { for _, test := range migrationTests { - test := test t.Run(test.name, func(t *testing.T) { migtest.ApplyMigration( t, diff --git a/channeldb/migration16/migration_test.go b/channeldb/migration16/migration_test.go index dc2d017fb..7fb55466e 100644 --- a/channeldb/migration16/migration_test.go +++ b/channeldb/migration16/migration_test.go @@ -105,7 +105,6 @@ func TestMigrateSequenceIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Before the migration we have a payments bucket. diff --git a/channeldb/migration23/migration_test.go b/channeldb/migration23/migration_test.go index 350c4cc91..c2dbdfd7b 100644 --- a/channeldb/migration23/migration_test.go +++ b/channeldb/migration23/migration_test.go @@ -155,7 +155,6 @@ func TestMigrateHtlcAttempts(t *testing.T) { } for _, test := range tests { - test := test migtest.ApplyMigration( t, diff --git a/channeldb/migration25/migration_test.go b/channeldb/migration25/migration_test.go index 6098e440e..4c67c0775 100644 --- a/channeldb/migration25/migration_test.go +++ b/channeldb/migration25/migration_test.go @@ -229,7 +229,6 @@ func TestMigrateInitialBalances(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { migtest.ApplyMigration( t, diff --git a/channeldb/migration26/migration_test.go b/channeldb/migration26/migration_test.go index a775386f7..dd1247db4 100644 --- a/channeldb/migration26/migration_test.go +++ b/channeldb/migration26/migration_test.go @@ -85,7 +85,6 @@ func TestMigrateBalancesToTlvRecords(t *testing.T) { } for _, tc := range testCases { - tc := tc // Before running the test, set the balance fields based on the // test params. diff --git a/channeldb/migration27/migration_test.go b/channeldb/migration27/migration_test.go index f2005ed65..d8d769d2f 100644 --- a/channeldb/migration27/migration_test.go +++ b/channeldb/migration27/migration_test.go @@ -97,7 +97,6 @@ func TestMigrateHistoricalBalances(t *testing.T) { } for _, tc := range testCases { - tc := tc // testChannel is used to test the balance fields are correctly // set. diff --git a/channeldb/migration30/iterator_test.go b/channeldb/migration30/iterator_test.go index 8d2206eb5..de654a017 100644 --- a/channeldb/migration30/iterator_test.go +++ b/channeldb/migration30/iterator_test.go @@ -123,7 +123,6 @@ func TestLocateChanBucket(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := testLocator(tc.locator) require.Equal(t, tc.expectedErr, err) @@ -283,7 +282,6 @@ func TestFindNextMigrateHeight(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Create a test channel. c := createTestChannel(nil) @@ -658,7 +656,6 @@ func TestLocalNextUpdateNum(t *testing.T) { cdb, err := migtest.MakeDB(t) require.NoError(t, err) - tc := tc t.Run(tc.name, func(t *testing.T) { // Setup the test case. c, height := tc.setup(cdb) diff --git a/channeldb/migration30/migration_test.go b/channeldb/migration30/migration_test.go index 01773292c..9202d9168 100644 --- a/channeldb/migration30/migration_test.go +++ b/channeldb/migration30/migration_test.go @@ -78,7 +78,6 @@ func TestMigrateRevocationLog(t *testing.T) { fmt.Printf("withAmtData is set to: %v\n", withAmtData) for i, tc := range testCases { - tc := tc // Construct a test case name that can be easily traced. name := fmt.Sprintf("case_%d", i) @@ -169,7 +168,6 @@ func TestValidateMigration(t *testing.T) { } for _, tc := range testCases { - tc := tc // Create a test db. cdb, err := migtest.MakeDB(t) diff --git a/channeldb/migration35/migration_test.go b/channeldb/migration35/migration_test.go index 685f57537..1d30c3f33 100644 --- a/channeldb/migration35/migration_test.go +++ b/channeldb/migration35/migration_test.go @@ -186,8 +186,6 @@ func TestMigrateWaitingProofStore(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/channeldb/reports_test.go b/channeldb/reports_test.go index 1148fdf03..6f0c21c1f 100644 --- a/channeldb/reports_test.go +++ b/channeldb/reports_test.go @@ -46,7 +46,6 @@ func TestPersistReport(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { db, err := MakeTestDB(t) @@ -193,7 +192,6 @@ func TestFetchChannelWriteBucket(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { db, err := MakeTestDB(t) diff --git a/channeldb/revocation_log_test.go b/channeldb/revocation_log_test.go index 6e7afb9a3..347e86e4f 100644 --- a/channeldb/revocation_log_test.go +++ b/channeldb/revocation_log_test.go @@ -341,7 +341,6 @@ func TestSerializeAndDeserializeRevLog(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -586,7 +585,6 @@ func TestPutRevocationLog(t *testing.T) { } for _, tc := range testCases { - tc := tc fullDB, err := MakeTestDB(t) require.NoError(t, err) @@ -686,7 +684,6 @@ func TestFetchRevocationLogCompatible(t *testing.T) { } for _, tc := range testCases { - tc := tc fullDB, err := MakeTestDB(t) require.NoError(t, err) diff --git a/channeldb/waitingproof_test.go b/channeldb/waitingproof_test.go index 4b0e44416..ad0436936 100644 --- a/channeldb/waitingproof_test.go +++ b/channeldb/waitingproof_test.go @@ -129,8 +129,6 @@ func TestWaitingProofV2RoundTrip(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/config_onion_ratelimit_test.go b/config_onion_ratelimit_test.go index b97a75785..3ac6bd5c1 100644 --- a/config_onion_ratelimit_test.go +++ b/config_onion_ratelimit_test.go @@ -73,7 +73,6 @@ func TestValidateOnionMsgLimiter(t *testing.T) { }, } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() err := validateOnionMsgLimiter( diff --git a/contractcourt/chain_watcher_coop_reorg_test.go b/contractcourt/chain_watcher_coop_reorg_test.go index 0e0a55219..a97c00e09 100644 --- a/contractcourt/chain_watcher_coop_reorg_test.go +++ b/contractcourt/chain_watcher_coop_reorg_test.go @@ -132,7 +132,6 @@ func TestChainWatcherCoopCloseScaledConfirmationsWithReorg(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/contractcourt/chain_watcher_test.go b/contractcourt/chain_watcher_test.go index 8275886a1..c7287d35c 100644 --- a/contractcourt/chain_watcher_test.go +++ b/contractcourt/chain_watcher_test.go @@ -499,7 +499,6 @@ func TestChainWatcherDataLossProtect(t *testing.T) { testName := fmt.Sprintf("num_updates=%v,broadcast_state_num=%v", testCase.NumUpdates, testCase.BroadcastStateNum) - testCase := testCase t.Run(testName, func(t *testing.T) { t.Parallel() @@ -724,7 +723,6 @@ func TestChainWatcherLocalForceCloseDetect(t *testing.T) { testCase.localOutputOnly, ) - testCase := testCase t.Run(testName, func(t *testing.T) { t.Parallel() diff --git a/contractcourt/channel_arbitrator_test.go b/contractcourt/channel_arbitrator_test.go index 37b931039..0e08d2cc4 100644 --- a/contractcourt/channel_arbitrator_test.go +++ b/contractcourt/channel_arbitrator_test.go @@ -1678,7 +1678,6 @@ func TestChannelArbitratorCommitFailure(t *testing.T) { } for _, test := range testCases { - test := test log := &mockArbitratorLog{ state: StateDefault, @@ -1889,7 +1888,6 @@ func TestChannelArbitratorDanglingCommitForceClose(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase testName := fmt.Sprintf("testCase: htlcExpired=%v,"+ "remotePendingHTLC=%v,remotePendingCommitConf=%v", testCase.htlcExpired, testCase.remotePendingHTLC, @@ -2214,7 +2212,6 @@ func TestRemoteCloseInitiator(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -2479,7 +2476,6 @@ func TestFindCommitmentDeadlineAndValue(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Mock the method `FindOutgoingHTLCDeadline`. tc.mockFindOutgoingHTLCDeadline() @@ -3074,7 +3070,6 @@ func TestChannelArbitratorStartForceCloseFail(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/contractcourt/commit_sweep_resolver_test.go b/contractcourt/commit_sweep_resolver_test.go index 5c660e100..eb00b3d73 100644 --- a/contractcourt/commit_sweep_resolver_test.go +++ b/contractcourt/commit_sweep_resolver_test.go @@ -348,7 +348,6 @@ func TestCommitSweepResolverDelay(t *testing.T) { }} for _, tc := range testCases { - tc := tc ok := t.Run(tc.name, func(t *testing.T) { testCommitSweepResolverDelay(t, tc.sweepErr) }) diff --git a/contractcourt/htlc_timeout_resolver_test.go b/contractcourt/htlc_timeout_resolver_test.go index e97af28ce..86ebede86 100644 --- a/contractcourt/htlc_timeout_resolver_test.go +++ b/contractcourt/htlc_timeout_resolver_test.go @@ -1488,7 +1488,6 @@ func TestCheckSizeAndIndex(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -1558,7 +1557,6 @@ func TestIsPreimageSpend(t *testing.T) { } for _, tc := range testCases { - tc := tc // Run the test. t.Run(tc.name, func(t *testing.T) { diff --git a/contractcourt/utxonursery_test.go b/contractcourt/utxonursery_test.go index f9dd302c9..a99eb7eaf 100644 --- a/contractcourt/utxonursery_test.go +++ b/contractcourt/utxonursery_test.go @@ -687,7 +687,6 @@ func TestRejectedCribTransaction(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -1386,8 +1385,6 @@ func TestPatchZeroHeightHint(t *testing.T) { } for _, tc := range tests { - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/discovery/gossiper_test.go b/discovery/gossiper_test.go index 199532642..d6fe209c0 100644 --- a/discovery/gossiper_test.go +++ b/discovery/gossiper_test.go @@ -222,14 +222,12 @@ func (r *mockGraphSource) ForAllOutgoingChannels(_ context.Context, chans := make(map[uint64]graphdb.ChannelEdge) for _, info := range r.infos { - info := info edgeInfo := chans[info.ChannelID] edgeInfo.Info = &info chans[info.ChannelID] = edgeInfo } for _, edges := range r.edges { - edges := edges edge := chans[edges[0].ChannelID] edge.Policy1 = &edges[0] diff --git a/discovery/syncer_test.go b/discovery/syncer_test.go index 1fd007295..f27ba7be5 100644 --- a/discovery/syncer_test.go +++ b/discovery/syncer_test.go @@ -2296,7 +2296,6 @@ func TestGossipSyncerSyncTransitions(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -2626,7 +2625,6 @@ func TestGossipSyncerStateHandlerErrors(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/feature/deps_test.go b/feature/deps_test.go index 9b6b02fa0..34766eb45 100644 --- a/feature/deps_test.go +++ b/feature/deps_test.go @@ -150,7 +150,6 @@ var depTests = []depTest{ // dependencies. func TestValidateDeps(t *testing.T) { for _, test := range depTests { - test := test t.Run(test.name, func(t *testing.T) { testValidateDeps(t, test) }) diff --git a/feature/manager_internal_test.go b/feature/manager_internal_test.go index 683b4dfa3..c110fc7a9 100644 --- a/feature/manager_internal_test.go +++ b/feature/manager_internal_test.go @@ -65,7 +65,6 @@ var managerTests = []managerTest{ // including that the proper features are removed in response to config changes. func TestManager(t *testing.T) { for _, test := range managerTests { - test := test t.Run(test.name, func(t *testing.T) { testManager(t, test) }) @@ -260,7 +259,6 @@ func TestUpdateFeatureSets(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/funding/batch_test.go b/funding/batch_test.go index 7a674d60b..ee74082a4 100644 --- a/funding/batch_test.go +++ b/funding/batch_test.go @@ -343,7 +343,6 @@ func TestBatchFund(t *testing.T) { }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/funding/commitment_type_negotiation_test.go b/funding/commitment_type_negotiation_test.go index 48b1a62ac..75907dfce 100644 --- a/funding/commitment_type_negotiation_test.go +++ b/funding/commitment_type_negotiation_test.go @@ -499,7 +499,6 @@ func TestCommitmentTypeNegotiation(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase ok := t.Run(testCase.name, func(t *testing.T) { localFeatures := lnwire.NewFeatureVector( testCase.localFeatures, lnwire.Features, diff --git a/funding/manager_test.go b/funding/manager_test.go index 42209127f..b4581cecc 100644 --- a/funding/manager_test.go +++ b/funding/manager_test.go @@ -3609,7 +3609,6 @@ func TestFundingManagerInvalidChanReserve(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -4355,7 +4354,6 @@ func TestFundingManagerFundMax(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -4464,7 +4462,6 @@ func TestGetUpfrontShutdownScript(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { var mockPeer testNode @@ -4742,7 +4739,6 @@ func TestFundingManagerUpfrontShutdown(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testUpfrontFailure(t, test.pkscript, test.expectErr) diff --git a/graph/builder_test.go b/graph/builder_test.go index 5b6243954..3d5cf8e1a 100644 --- a/graph/builder_test.go +++ b/graph/builder_test.go @@ -1106,8 +1106,6 @@ func TestIsZombieChannel(t *testing.T) { } for _, test := range tests { - test := test - t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index 3d0156ff0..e524f0b1f 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -252,8 +252,6 @@ func TestVersionedDBs(t *testing.T) { // Run all v1 tests. for _, vt := range versionedTests { - vt := vt - t.Run(vt.name+"/v1", func(t *testing.T) { vt.test(t, lnwire.GossipVersion1) }) @@ -1954,7 +1952,6 @@ func TestGraphCacheTraversal(t *testing.T) { // properly been reached. numNodeChans := 0 for _, node := range nodeList { - node := node err := graph.ForEachNodeDirectedChannel( ctx, node.PubKeyBytes, func(d *DirectedChannel) error { @@ -4142,7 +4139,6 @@ func TestStressTestChannelGraphAPI(t *testing.T) { ) for i := 0; i < concurrencyLevel; i++ { - i := i t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel() @@ -4347,7 +4343,6 @@ func TestFilterChannelRange(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/htlcswitch/hop/iterator_test.go b/htlcswitch/hop/iterator_test.go index ab435a986..e3d1efd9c 100644 --- a/htlcswitch/hop/iterator_test.go +++ b/htlcswitch/hop/iterator_test.go @@ -139,7 +139,6 @@ func TestForwardingAmountCalc(t *testing.T) { } for _, testCase := range tests { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/htlcswitch/hop/payload_test.go b/htlcswitch/hop/payload_test.go index bd0081cb9..7b3e56836 100644 --- a/htlcswitch/hop/payload_test.go +++ b/htlcswitch/hop/payload_test.go @@ -758,7 +758,6 @@ func TestValidateBlindedRouteData(t *testing.T) { } for _, testCase := range tests { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { err := hop.ValidateBlindedRouteData( diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 29b4f902d..6a518cbfa 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -922,7 +922,6 @@ func TestChannelLinkCancelFullCommitment(t *testing.T) { // Now, settle all htlcs held by bob and clear the commitment of htlcs. for _, preimage := range preimages { - preimage := preimage // It's possible that the HTLCs have not been delivered to the // invoice registry at this point, so we poll until we are able diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index e8176aaeb..9dfe22e7b 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -441,7 +441,6 @@ func TestSwitchForwardMapping(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() testSwitchForwardMapping( @@ -661,7 +660,6 @@ func TestSwitchSendHTLCMapping(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() testSwitchSendHtlcMapping( @@ -1917,7 +1915,6 @@ func TestCircularForwards(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -2099,7 +2096,6 @@ func TestCheckCircularForward(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -2183,7 +2179,6 @@ func TestSkipIneligibleLinksMultiHopForward(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSkipIneligibleLinksMultiHopForward(t, &test) }) @@ -3371,7 +3366,6 @@ func TestHtlcNotifier(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testHtcNotifier( @@ -4864,7 +4858,6 @@ func TestSwitchForwardFailAlias(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSwitchForwardFailAlias(t, test.zeroConf) @@ -5074,7 +5067,6 @@ func TestSwitchAliasFailAdd(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSwitchAliasFailAdd( @@ -5263,7 +5255,6 @@ func TestSwitchHandlePacketForward(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSwitchHandlePacketForward( @@ -5420,7 +5411,6 @@ func TestSwitchAliasInterceptFail(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSwitchAliasInterceptFail(t, test.zeroConf) diff --git a/input/musig2_test.go b/input/musig2_test.go index 1fccd1686..dea5d3d31 100644 --- a/input/musig2_test.go +++ b/input/musig2_test.go @@ -178,7 +178,6 @@ func TestMuSig2CombineKeys(t *testing.T) { }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { tt.Parallel() diff --git a/input/size_test.go b/input/size_test.go index 88a66c75a..b0531b1b8 100644 --- a/input/size_test.go +++ b/input/size_test.go @@ -1579,7 +1579,6 @@ var witnessSizeTests = []witnessSizeTest{ // aren't under estimating or our transactions could get stuck. func TestWitnessSizes(t *testing.T) { for _, test := range witnessSizeTests { - test := test t.Run(test.name, func(t *testing.T) { size := test.genWitness(t).SerializeSize() if size != test.expSize { @@ -1793,7 +1792,6 @@ var txSizeTests = []txSizeTest{ // TestTxSizes asserts the correctness of our magic tx size constants. func TestTxSizes(t *testing.T) { for _, test := range txSizeTests { - test := test t.Run(test.name, func(t *testing.T) { tx := test.genTx(t) diff --git a/input/taproot_test.go b/input/taproot_test.go index 7defa9eb1..8405092f9 100644 --- a/input/taproot_test.go +++ b/input/taproot_test.go @@ -388,8 +388,6 @@ func testTaprootSenderHtlcSpend(t *testing.T, auxLeaf AuxTapLeaf, } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() @@ -883,8 +881,6 @@ func testTaprootReceiverHtlcSpend(t *testing.T, auxLeaf AuxTapLeaf, }, } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() t.Run(testCase.name, func(t *testing.T) { @@ -1225,8 +1221,6 @@ func testTaprootCommitScriptToSelf(t *testing.T, auxLeaf AuxTapLeaf, } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() t.Run(testCase.name, func(t *testing.T) { @@ -1439,8 +1433,6 @@ func testTaprootCommitScriptRemote(t *testing.T, auxLeaf AuxTapLeaf, } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() t.Run(testCase.name, func(t *testing.T) { @@ -1695,8 +1687,6 @@ func TestTaprootAnchorScript(t *testing.T) { } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() t.Run(testCase.name, func(t *testing.T) { @@ -1984,8 +1974,6 @@ func testTaprootSecondLevelHtlcScript(t *testing.T, auxLeaf AuxTapLeaf, } for i, testCase := range testCases { - i := i - testCase := testCase spendTxCopy := spendTx.Copy() t.Run(testCase.name, func(t *testing.T) { diff --git a/internal/musig2v040/musig2_test.go b/internal/musig2v040/musig2_test.go index 42e84c781..a56317676 100644 --- a/internal/musig2v040/musig2_test.go +++ b/internal/musig2v040/musig2_test.go @@ -1048,7 +1048,6 @@ func testMultiPartySign(t *testing.T, taprootTweak []byte, // signer. var wg sync.WaitGroup for i, signCtx := range signers { - signCtx := signCtx wg.Add(1) go func(idx int, signer *Session) { diff --git a/invoices/invoiceregistry_test.go b/invoices/invoiceregistry_test.go index 785da115e..cad3e27d7 100644 --- a/invoices/invoiceregistry_test.go +++ b/invoices/invoiceregistry_test.go @@ -159,7 +159,6 @@ func TestInvoiceRegistry(t *testing.T) { } for _, test := range testList { - test := test t.Run(test.name+"_KV", func(t *testing.T) { test.test(t, makeKeyValueDB) @@ -1924,7 +1923,6 @@ func testSpontaneousAmpPayment(t *testing.T, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testSpontaneousAmpPaymentImpl( t, test.ampEnabled, test.failReconstruction, diff --git a/invoices/invoices_test.go b/invoices/invoices_test.go index 0f7e473eb..987292bfa 100644 --- a/invoices/invoices_test.go +++ b/invoices/invoices_test.go @@ -261,7 +261,6 @@ func TestInvoices(t *testing.T) { } for _, test := range testList { - test := test t.Run(test.name+"_KV", func(t *testing.T) { test.test(t, makeKeyValueDB) }) @@ -340,7 +339,6 @@ func testInvoiceWorkflow(t *testing.T, t.Parallel() for _, test := range invWorkflowTests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() testInvoiceWorkflowImpl(t, test, makeDB) @@ -2618,7 +2616,6 @@ func testUpdateHTLCPreimages(t *testing.T, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() testUpdateHTLCPreimagesImpl(t, test, makeDB) diff --git a/invoices/kv_sql_migration_test.go b/invoices/kv_sql_migration_test.go index 709a3c8e1..d14a63f58 100644 --- a/invoices/kv_sql_migration_test.go +++ b/invoices/kv_sql_migration_test.go @@ -134,7 +134,6 @@ func TestMigrationWithChannelDB(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { var kvStore *channeldb.DB diff --git a/invoices/update_invoice_test.go b/invoices/update_invoice_test.go index 6069fbecd..d6e4ed9e3 100644 --- a/invoices/update_invoice_test.go +++ b/invoices/update_invoice_test.go @@ -744,7 +744,6 @@ func TestUpdateHTLC(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testUpdateHTLC(t, test, testNow) }) diff --git a/itest/lnd_coop_close_rbf_test.go b/itest/lnd_coop_close_rbf_test.go index f1acf0288..f607e5058 100644 --- a/itest/lnd_coop_close_rbf_test.go +++ b/itest/lnd_coop_close_rbf_test.go @@ -157,7 +157,6 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) { } for _, chanType := range channelTypes { - chanType := chanType ht.Run(chanType.name, func(t1 *testing.T) { st := ht.Subtest(t1) // Set the fee estimate to 1sat/vbyte. This ensures that diff --git a/itest/lnd_coop_close_with_htlcs_test.go b/itest/lnd_coop_close_with_htlcs_test.go index 06d4dc9ab..b35b526fd 100644 --- a/itest/lnd_coop_close_with_htlcs_test.go +++ b/itest/lnd_coop_close_with_htlcs_test.go @@ -72,7 +72,6 @@ func testCoopCloseWithHtlcs(ht *lntest.HarnessTest) { testCases := createFlagCombos() for _, testCase := range testCases { - testCase := testCase // Capture range variable. ht.Run(testCase.testName, func(t *testing.T) { tt := ht.Subtest(t) @@ -94,7 +93,6 @@ func testCoopCloseWithHtlcsWithRestart(ht *lntest.HarnessTest) { testCases := createFlagCombos() for _, testCase := range testCases { - testCase := testCase // Capture range variable. ht.Run(testCase.testName, func(t *testing.T) { tt := ht.Subtest(t) diff --git a/itest/lnd_etcd_failover_test.go b/itest/lnd_etcd_failover_test.go index 53b1dd6b3..3821229fa 100644 --- a/itest/lnd_etcd_failover_test.go +++ b/itest/lnd_etcd_failover_test.go @@ -47,7 +47,6 @@ func testEtcdFailover(ht *lntest.HarnessTest) { }} for _, test := range testCases { - test := test success := ht.Run(test.name, func(t1 *testing.T) { st := ht.Subtest(t1) diff --git a/itest/lnd_forward_delete_test.go b/itest/lnd_forward_delete_test.go index d3a0a0b41..678a0d708 100644 --- a/itest/lnd_forward_delete_test.go +++ b/itest/lnd_forward_delete_test.go @@ -43,7 +43,6 @@ func testDeleteForwardingHistory(ht *lntest.HarnessTest) { } for _, tc := range testCases { - tc := tc success := ht.Run(tc.name, func(t *testing.T) { st := ht.Subtest(t) tc.test(st) diff --git a/itest/lnd_macaroons_test.go b/itest/lnd_macaroons_test.go index 70c50c3b3..ddd48b1df 100644 --- a/itest/lnd_macaroons_test.go +++ b/itest/lnd_macaroons_test.go @@ -391,7 +391,6 @@ func testMacaroonAuthentication(ht *lntest.HarnessTest) { }} for _, tc := range testCases { - tc := tc ht.Run(tc.name, func(tt *testing.T) { ctxt, cancel := context.WithTimeout( ht.Context(), defaultTimeout, @@ -607,7 +606,6 @@ func testBakeMacaroon(ht *lntest.HarnessTest) { }} for _, tc := range testCases { - tc := tc ht.Run(tc.name, func(tt *testing.T) { ctxt, cancel := context.WithTimeout( ht.Context(), defaultTimeout, diff --git a/itest/lnd_nonstd_sweep_test.go b/itest/lnd_nonstd_sweep_test.go index 47725f12b..ca596d10d 100644 --- a/itest/lnd_nonstd_sweep_test.go +++ b/itest/lnd_nonstd_sweep_test.go @@ -62,7 +62,6 @@ func testNonstdSweep(ht *lntest.HarnessTest) { } for _, test := range tests { - test := test success := ht.Run(test.name, func(t *testing.T) { st := ht.Subtest(t) diff --git a/itest/lnd_rest_api_test.go b/itest/lnd_rest_api_test.go index 70e103208..5ec4823f3 100644 --- a/itest/lnd_rest_api_test.go +++ b/itest/lnd_rest_api_test.go @@ -221,14 +221,12 @@ func testRestAPI(ht *lntest.HarnessTest) { alice := ht.NewNodeWithCoins("Alice", args) for _, tc := range testCases { - tc := tc ht.Run(tc.name, func(t *testing.T) { tc.run(t, alice, bob) }) } for _, tc := range wsTestCases { - tc := tc ht.Run(tc.name, func(t *testing.T) { st := ht.Subtest(t) tc.run(st) diff --git a/itest/lnd_rpc_middleware_interceptor_test.go b/itest/lnd_rpc_middleware_interceptor_test.go index e0409af32..3a82e5a99 100644 --- a/itest/lnd_rpc_middleware_interceptor_test.go +++ b/itest/lnd_rpc_middleware_interceptor_test.go @@ -205,7 +205,6 @@ func middlewareRegistrationRestrictionTests(t *testing.T, }} for idx, tc := range testCases { - tc := tc t.Run(fmt.Sprintf("%d", idx), func(tt *testing.T) { invalidName := registerMiddleware( diff --git a/itest/lnd_test.go b/itest/lnd_test.go index c073cb50b..e6b25b657 100644 --- a/itest/lnd_test.go +++ b/itest/lnd_test.go @@ -128,7 +128,6 @@ func TestLightningNetworkDaemon(t *testing.T) { // Run the subset of the test cases selected in this tranche. for idx, testCase := range testCases { - testCase := testCase name := fmt.Sprintf("tranche%02d/%02d-of-%d/%s/%s", trancheIndex, trancheOffset+uint(idx)+1, len(allTestCases), harnessTest.ChainBackendName(), diff --git a/itest/lnd_wallet_import_test.go b/itest/lnd_wallet_import_test.go index 4a08fb2e6..39774ba19 100644 --- a/itest/lnd_wallet_import_test.go +++ b/itest/lnd_wallet_import_test.go @@ -646,7 +646,6 @@ func testWalletImportPubKey(ht *lntest.HarnessTest) { } for _, tc := range testCases { - tc := tc success := ht.Run(tc.name, func(tt *testing.T) { testFunc := func(ht *lntest.HarnessTest) { testWalletImportPubKeyScenario( diff --git a/itest/lnd_zero_conf_test.go b/itest/lnd_zero_conf_test.go index ac82ba0d5..84602ec1d 100644 --- a/itest/lnd_zero_conf_test.go +++ b/itest/lnd_zero_conf_test.go @@ -281,7 +281,6 @@ func testOptionScidAlias(ht *lntest.HarnessTest) { } for _, testCase := range testCases { - testCase := testCase success := ht.Run(testCase.name, func(t *testing.T) { st := ht.Subtest(t) optionScidAliasScenario( diff --git a/lnencrypt/crypto_test.go b/lnencrypt/crypto_test.go index 42ebe1cc2..dfe224f63 100644 --- a/lnencrypt/crypto_test.go +++ b/lnencrypt/crypto_test.go @@ -66,9 +66,7 @@ func TestEncryptDecryptPayload(t *testing.T) { require.NoError(t, err) for _, payloadCase := range payloadCases { - payloadCase := payloadCase for _, enc := range []*Encrypter{keyRingEnc, privKeyEnc} { - enc := enc // First, we'll encrypt the passed payload with our // scheme. diff --git a/lnrpc/invoicesrpc/addinvoice_test.go b/lnrpc/invoicesrpc/addinvoice_test.go index 104b2873d..41ab63e36 100644 --- a/lnrpc/invoicesrpc/addinvoice_test.go +++ b/lnrpc/invoicesrpc/addinvoice_test.go @@ -448,7 +448,6 @@ var shouldIncludeChannelTestCases = []struct { func TestShouldIncludeChannel(t *testing.T) { for _, tc := range shouldIncludeChannelTestCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -514,7 +513,6 @@ var sufficientHintsTestCases = []struct { func TestSufficientHints(t *testing.T) { for _, tc := range sufficientHintsTestCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -881,7 +879,6 @@ func setupMockTwoChannels(h *hopHintsConfigMock) (lnwire.ChannelID, func TestPopulateHopHints(t *testing.T) { for _, tc := range populateHopHintsTestCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/lnrpc/routerrpc/parse_duration_test.go b/lnrpc/routerrpc/parse_duration_test.go index d36c8be39..66c8c3bbd 100644 --- a/lnrpc/routerrpc/parse_duration_test.go +++ b/lnrpc/routerrpc/parse_duration_test.go @@ -128,7 +128,6 @@ func TestParseDuration(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() diff --git a/lnrpc/routerrpc/router_backend_test.go b/lnrpc/routerrpc/router_backend_test.go index d4ff22420..b494ffb22 100644 --- a/lnrpc/routerrpc/router_backend_test.go +++ b/lnrpc/routerrpc/router_backend_test.go @@ -337,7 +337,6 @@ func TestUnmarshalMPP(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testUnmarshalMPP(t, test) }) @@ -447,7 +446,6 @@ func TestUnmarshalAMP(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testUnmarshalAMP(t, test) }) diff --git a/lnrpc/walletrpc/walletkit_server_test.go b/lnrpc/walletrpc/walletkit_server_test.go index 40fb62ef2..041a9d1a4 100644 --- a/lnrpc/walletrpc/walletkit_server_test.go +++ b/lnrpc/walletrpc/walletkit_server_test.go @@ -43,8 +43,6 @@ func TestWitnessTypeMapping(t *testing.T) { for witnessType, witnessTypeProto := range allWitnessTypes { // Redeclare to avoid loop variables being captured // by func literal. - witnessType := witnessType - witnessTypeProto := witnessTypeProto t.Run(witnessType.String(), func(tt *testing.T) { tt.Parallel() @@ -629,7 +627,6 @@ func TestFundPsbtCoinSelect(t *testing.T) { }} for _, tc := range testCases { - tc := tc privKey, err := btcec.NewPrivateKey() require.NoError(t, err) diff --git a/lnrpc/walletrpc/walletkit_util_test.go b/lnrpc/walletrpc/walletkit_util_test.go index fdc8d2e0a..097c51315 100644 --- a/lnrpc/walletrpc/walletkit_util_test.go +++ b/lnrpc/walletrpc/walletkit_util_test.go @@ -55,7 +55,6 @@ func TestParseDerivationPath(t *testing.T) { }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { result, err := parseDerivationPath(tc.path) diff --git a/lnutils/fs_test.go b/lnutils/fs_test.go index 3e96d4faf..c23250441 100644 --- a/lnutils/fs_test.go +++ b/lnutils/fs_test.go @@ -66,7 +66,6 @@ func TestCreateDir(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { dir := tc.setup() defer os.RemoveAll(dir) diff --git a/lnwallet/btcwallet/psbt_test.go b/lnwallet/btcwallet/psbt_test.go index 694a8c04f..4423be00c 100644 --- a/lnwallet/btcwallet/psbt_test.go +++ b/lnwallet/btcwallet/psbt_test.go @@ -277,7 +277,6 @@ func TestSignPsbt(t *testing.T) { }} for _, tc := range testCases { - tc := tc // This is the private key we're going to sign with. privKey, err := w.deriveKeyByBIP32Path(tc.inputType.keyPath()) @@ -465,7 +464,6 @@ func TestEstimateInputWeight(t *testing.T) { input.WitnessHeaderSize for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { estimator := input.TxWeightEstimator{} @@ -551,7 +549,6 @@ func TestBip32DerivationFromKeyDesc(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { d, trD, path := Bip32DerivationFromKeyDesc( @@ -607,7 +604,6 @@ func TestBip32DerivationFromAddress(t *testing.T) { w, _ := newTestWallet(t, netParams, seedBytes) for _, tc := range testCases { - tc := tc addr, err := w.NewAddress( tc.addrType, false, lnwallet.DefaultAccountName, diff --git a/lnwallet/btcwallet/signer_test.go b/lnwallet/btcwallet/signer_test.go index 6f288c224..803296fa2 100644 --- a/lnwallet/btcwallet/signer_test.go +++ b/lnwallet/btcwallet/signer_test.go @@ -188,7 +188,6 @@ func TestBip32KeyDerivation(t *testing.T) { // Let's go through the test cases now that we know our wallet is ready. for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { privKey, err := w.deriveKeyByBIP32Path(tc.path) @@ -513,7 +512,6 @@ func TestMaybeTweakPrivKey(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Create a sign descriptor with the test tweaks. signDesc := &input.SignDescriptor{ diff --git a/lnwallet/chainfee/estimator_test.go b/lnwallet/chainfee/estimator_test.go index 3d355d503..67fe6d41b 100644 --- a/lnwallet/chainfee/estimator_test.go +++ b/lnwallet/chainfee/estimator_test.go @@ -261,7 +261,6 @@ func TestWebAPIFeeEstimator(t *testing.T) { require.NoError(t, estimator.Start(), "unable to start fee estimator") for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { est, err := estimator.EstimateFeePerKW(tc.target) @@ -361,7 +360,6 @@ func TestGetCachedFee(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { cachedFee, err := estimator.getCachedFee(tc.confTarget) diff --git a/lnwallet/chainfee/filtermanager_test.go b/lnwallet/chainfee/filtermanager_test.go index 085814d96..0271c81e7 100644 --- a/lnwallet/chainfee/filtermanager_test.go +++ b/lnwallet/chainfee/filtermanager_test.go @@ -35,7 +35,6 @@ func TestFeeFilterMedian(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { cb := func() ([]SatPerKWeight, error) { return nil, nil diff --git a/lnwallet/chancloser/chancloser_test.go b/lnwallet/chancloser/chancloser_test.go index 16afb656b..a89a5b90e 100644 --- a/lnwallet/chancloser/chancloser_test.go +++ b/lnwallet/chancloser/chancloser_test.go @@ -123,7 +123,6 @@ func TestMaybeMatchScript(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -361,7 +360,6 @@ func TestMaxFeeClamp(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -398,7 +396,6 @@ func TestMaxFeeBailOut(t *testing.T) { ) for _, isInitiator := range []bool{true, false} { - isInitiator := isInitiator t.Run(fmt.Sprintf("initiator=%v", isInitiator), func(t *testing.T) { t.Parallel() @@ -494,7 +491,6 @@ func TestParseUpfrontShutdownAddress(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/lnwallet/chanfunding/coin_select_test.go b/lnwallet/chanfunding/coin_select_test.go index e20259c86..312ae7d07 100644 --- a/lnwallet/chanfunding/coin_select_test.go +++ b/lnwallet/chanfunding/coin_select_test.go @@ -123,7 +123,6 @@ func TestCalculateFees(t *testing.T) { fundingOutputEstimate.AddP2WSHOutput() for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { feeNoChange, feeWithChange, err := calculateFees( test.utxos, feeRate, fundingOutputEstimate, @@ -309,7 +308,6 @@ func TestCoinSelect(t *testing.T) { fundingOutputEstimate.AddP2WSHOutput() for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -451,7 +449,6 @@ func TestCalculateChangeAmount(t *testing.T) { }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(tt *testing.T) { changeAmt, needMore, err := CalculateChangeAmount( tc.totalInputAmt, tc.requiredAmt, @@ -644,7 +641,6 @@ func TestCoinSelectSubtractFees(t *testing.T) { fundingOutputEstimate.AddP2WSHOutput() for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { feeRate := feeRate @@ -893,7 +889,6 @@ func TestCoinSelectUpToAmount(t *testing.T) { fundingOutputEstimate.AddP2WSHOutput() for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/lnwallet/chanfunding/psbt_assembler_test.go b/lnwallet/chanfunding/psbt_assembler_test.go index 461b83f5a..71988e21c 100644 --- a/lnwallet/chanfunding/psbt_assembler_test.go +++ b/lnwallet/chanfunding/psbt_assembler_test.go @@ -456,7 +456,6 @@ func TestPsbtVerify(t *testing.T) { // Loop through all our test cases. for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Reset the state from a previous test and create a new // pending PSBT that we can manipulate. @@ -622,7 +621,6 @@ func TestPsbtFinalize(t *testing.T) { // Loop through all our test cases. for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Reset the state from a previous test and create a new // pending PSBT that we can manipulate. @@ -739,7 +737,6 @@ func TestVerifyAllInputsSegWit(t *testing.T) { }} for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { r := strings.NewReader(tc.packet) diff --git a/lnwallet/channel_test.go b/lnwallet/channel_test.go index ab96d3397..09822f337 100644 --- a/lnwallet/channel_test.go +++ b/lnwallet/channel_test.go @@ -387,7 +387,6 @@ func TestSimpleAddSettleWorkflow(t *testing.T) { t.Parallel() for _, tweakless := range []bool{true, false} { - tweakless := tweakless t.Run(fmt.Sprintf("tweakless=%v", tweakless), func(t *testing.T) { testAddSettleWorkflow(t, tweakless, 0, false) @@ -8927,7 +8926,6 @@ func TestFetchParent(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Create a lightning channel with newly initialized @@ -9274,7 +9272,6 @@ func TestEvaluateView(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { isInitiator := test.channelInitiator == lntypes.Local @@ -10312,7 +10309,6 @@ func TestCreateBreachRetribution(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { tx := spendTx if tc.noSpendTx { @@ -10741,7 +10737,6 @@ func TestApplyCommitmentFee(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { //nolint:ll balance, bufferAmt, commitFee, err := tc.channel.applyCommitFee( diff --git a/lnwallet/confscale_test.go b/lnwallet/confscale_test.go index 53165fc23..2b50b28ae 100644 --- a/lnwallet/confscale_test.go +++ b/lnwallet/confscale_test.go @@ -262,7 +262,6 @@ func TestScaleNumConfsKnownValues(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { result := ScaleNumConfs(tc.chanAmt, tc.pushAmt) diff --git a/lnwallet/parameters_test.go b/lnwallet/parameters_test.go index 3cee8f3e6..eef7e3640 100644 --- a/lnwallet/parameters_test.go +++ b/lnwallet/parameters_test.go @@ -38,7 +38,6 @@ func TestDefaultRoutingFeeLimitForAmount(t *testing.T) { } for _, test := range tests { - test := test t.Run(fmt.Sprintf("%d sats", test.amount), func(t *testing.T) { feeLimit := DefaultRoutingFeeLimitForAmount(test.amount) @@ -85,7 +84,6 @@ func TestDustLimitForSize(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { dustlimit := DustLimitForSize(test.size) diff --git a/lnwallet/transactions_test.go b/lnwallet/transactions_test.go index 38131eaa7..42639a4e6 100644 --- a/lnwallet/transactions_test.go +++ b/lnwallet/transactions_test.go @@ -226,7 +226,6 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) { } for _, set := range vectorSets { - set := set var testCases []testCase @@ -237,7 +236,6 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) { require.NoError(t, err) for _, test := range testCases { - test := test name := fmt.Sprintf("%s-%s", set.name, test.Name) t.Run(name, func(t *testing.T) { @@ -787,7 +785,6 @@ func TestCommitmentSpendValidation(t *testing.T) { // but we also need to support older nodes that want to open channels // with the legacy format, so we'll test spending in both scenarios. for _, tweakless := range []bool{true, false} { - tweakless := tweakless t.Run(fmt.Sprintf("tweak=%v", tweakless), func(t *testing.T) { testSpendValidation(t, tweakless) }) diff --git a/lnwire/accept_channel_test.go b/lnwire/accept_channel_test.go index 87d9dc029..b0b199ef7 100644 --- a/lnwire/accept_channel_test.go +++ b/lnwire/accept_channel_test.go @@ -29,7 +29,6 @@ func TestDecodeAcceptChannel(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { priv, err := btcec.NewPrivateKey() diff --git a/lnwire/features_test.go b/lnwire/features_test.go index c77ddd4d1..f18e7b379 100644 --- a/lnwire/features_test.go +++ b/lnwire/features_test.go @@ -340,7 +340,6 @@ func TestFeatures(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { fv := NewFeatureVector( toRawFV(test.exp), Features, @@ -508,7 +507,6 @@ func TestValidateUpdate(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/lnwire/local_nonces_test.go b/lnwire/local_nonces_test.go index e1b3c859c..1652f0424 100644 --- a/lnwire/local_nonces_test.go +++ b/lnwire/local_nonces_test.go @@ -78,7 +78,6 @@ func TestLocalNoncesDataEncodeDecodeValue(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -181,7 +180,6 @@ func TestLocalNoncesDataDecodeFailuresValue(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/lnwire/onion_error_test.go b/lnwire/onion_error_test.go index a3bbea5b7..1eae25096 100644 --- a/lnwire/onion_error_test.go +++ b/lnwire/onion_error_test.go @@ -93,7 +93,6 @@ func TestEncodeDecodeTlv(t *testing.T) { t.Parallel() for _, testFailure := range onionFailures { - testFailure := testFailure code := testFailure.Code().String() t.Run(code, func(t *testing.T) { diff --git a/lnwire/ping_test.go b/lnwire/ping_test.go index 0cc60cf1a..adbef29dc 100644 --- a/lnwire/ping_test.go +++ b/lnwire/ping_test.go @@ -19,7 +19,6 @@ func TestPingDecodeAllowsNoReplyPongSizes(t *testing.T) { testCases := []uint16{65532, 65535} for _, numPongBytes := range testCases { - numPongBytes := numPongBytes testName := strconv.FormatUint(uint64(numPongBytes), 10) t.Run(testName, func(t *testing.T) { diff --git a/lnwire/query_channel_range_test.go b/lnwire/query_channel_range_test.go index 5d690f38d..53c6bda94 100644 --- a/lnwire/query_channel_range_test.go +++ b/lnwire/query_channel_range_test.go @@ -39,7 +39,6 @@ func TestQueryChannelRange(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/lnwire/query_short_chan_ids_test.go b/lnwire/query_short_chan_ids_test.go index 996c9f744..a147061e6 100644 --- a/lnwire/query_short_chan_ids_test.go +++ b/lnwire/query_short_chan_ids_test.go @@ -50,7 +50,6 @@ var ( // that contains duplicate or unsorted ids returns an ErrUnsortedSIDs failure. func TestQueryShortChanIDsUnsorted(t *testing.T) { for _, test := range unsortedSidTests { - test := test t.Run(test.name, func(t *testing.T) { req := &QueryShortChanIDs{ EncodingType: test.encType, @@ -96,7 +95,6 @@ func TestQueryShortChanIDsZero(t *testing.T) { } for _, test := range testCases { - test := test t.Run(test.name, func(t *testing.T) { req := &QueryShortChanIDs{ EncodingType: test.encoding, diff --git a/lnwire/reply_channel_range_test.go b/lnwire/reply_channel_range_test.go index 12955cfd9..ac95066a5 100644 --- a/lnwire/reply_channel_range_test.go +++ b/lnwire/reply_channel_range_test.go @@ -12,7 +12,6 @@ import ( // that contains duplicate or unsorted ids returns an ErrUnsortedSIDs failure. func TestReplyChannelRangeUnsorted(t *testing.T) { for _, test := range unsortedSidTests { - test := test t.Run(test.name, func(t *testing.T) { req := &ReplyChannelRange{ EncodingType: test.encType, @@ -63,7 +62,6 @@ func TestReplyChannelRangeEmpty(t *testing.T) { } for _, test := range emptyChannelsTests { - test := test t.Run(test.name, func(t *testing.T) { req := ReplyChannelRange{ FirstBlockHeight: 1, @@ -210,7 +208,6 @@ func TestReplyChannelRangeEncode(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -327,7 +324,6 @@ func TestReplyChannelRangeDecode(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/lnwire/signature_test.go b/lnwire/signature_test.go index 73263f1a6..c47bf97af 100644 --- a/lnwire/signature_test.go +++ b/lnwire/signature_test.go @@ -273,7 +273,6 @@ func TestNewSigFromRawSignature(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { result, err := NewSigFromECDSARawSignature(tc.rawSig) require.Equal(t, tc.expectedErr, err) diff --git a/lnwire/writer_test.go b/lnwire/writer_test.go index bb2bada06..4f15ba52d 100644 --- a/lnwire/writer_test.go +++ b/lnwire/writer_test.go @@ -457,7 +457,6 @@ func TestWriteTCPAddr(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { oldLen := buf.Len() @@ -545,7 +544,6 @@ func TestWriteOnionAddr(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { oldLen := buf.Len() @@ -618,7 +616,6 @@ func TestWriteNetAddrs(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { buf := new(bytes.Buffer) diff --git a/netann/channel_update_test.go b/netann/channel_update_test.go index 2a619e062..fe0bc33bf 100644 --- a/netann/channel_update_test.go +++ b/netann/channel_update_test.go @@ -105,7 +105,6 @@ func TestUpdateDisableFlag(t *testing.T) { t.Parallel() for _, tc := range updateDisableTests { - tc := tc t.Run(tc.name, func(t *testing.T) { // Create the initial update, the only fields we are // concerned with in this test are the timestamp and the diff --git a/onionmessage/ratelimit_test.go b/onionmessage/ratelimit_test.go index c43a9ef1c..4f7885c2c 100644 --- a/onionmessage/ratelimit_test.go +++ b/onionmessage/ratelimit_test.go @@ -29,7 +29,6 @@ func TestGlobalLimiterDisabled(t *testing.T) { {"both zero", 0, 0}, } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() lim := NewGlobalLimiter(tc.kbps, tc.burstBytes) @@ -84,7 +83,6 @@ func TestPeerRateLimiterDisabled(t *testing.T) { {"both zero", 0, 0}, } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() p := NewPeerRateLimiter(tc.kbps, tc.burstBytes) @@ -217,7 +215,6 @@ func TestPeerRateLimiterConcurrentAllowN(t *testing.T) { var wg sync.WaitGroup var ops atomic.Uint64 for w := 0; w < workers; w++ { - w := w wg.Add(1) go func() { defer wg.Done() diff --git a/payments/db/payment_status_test.go b/payments/db/payment_status_test.go index 1bb4dc388..b5c762d07 100644 --- a/payments/db/payment_status_test.go +++ b/payments/db/payment_status_test.go @@ -168,7 +168,6 @@ func TestDecidePaymentStatus(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -228,7 +227,6 @@ func TestPaymentStatusActions(t *testing.T) { } for i, tc := range testCases { - i, tc := i, tc ps := tc.status name := fmt.Sprintf("test_%d_%s", i, ps.String()) diff --git a/payments/db/payment_test.go b/payments/db/payment_test.go index e304b136d..e77a1522a 100644 --- a/payments/db/payment_test.go +++ b/payments/db/payment_test.go @@ -783,8 +783,6 @@ func TestPaymentRegistrable(t *testing.T) { } for i, tc := range testCases { - i, tc := i, tc - p := &MPPayment{ Status: tc.status, State: &MPPaymentState{ @@ -901,8 +899,6 @@ func TestPaymentSetState(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -1034,8 +1030,6 @@ func TestNeedWaitAttempts(t *testing.T) { } for _, tc := range testCases { - tc := tc - p := &MPPayment{ Info: &PaymentCreationInfo{ PaymentIdentifier: [32]byte{1, 2, 3}, @@ -1212,8 +1206,6 @@ func TestAllowMoreAttempts(t *testing.T) { } for i, tc := range testCases { - tc := tc - p := &MPPayment{ Info: &PaymentCreationInfo{ PaymentIdentifier: [32]byte{1, 2, 3}, diff --git a/peer/brontide_test.go b/peer/brontide_test.go index f4bb661ea..0dc218d5c 100644 --- a/peer/brontide_test.go +++ b/peer/brontide_test.go @@ -737,7 +737,6 @@ func TestChooseDeliveryScript(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { script, err := chooseDeliveryScript( @@ -817,7 +816,6 @@ func TestCustomShutdownScript(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Open a channel. @@ -985,7 +983,6 @@ func TestStaticRemoteDowngrade(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { params := createTestPeer(t) @@ -1288,7 +1285,6 @@ func TestHandleNewPendingChannel(t *testing.T) { } for _, tc := range testCases { - tc := tc // Create a request for testing. errChan := make(chan error, 1) @@ -1373,7 +1369,6 @@ func TestHandleRemovePendingChannel(t *testing.T) { } for _, tc := range testCases { - tc := tc // Create a request for testing. errChan := make(chan error, 1) diff --git a/record/blinded_data_test.go b/record/blinded_data_test.go index bc1230be8..0620e9ba5 100644 --- a/record/blinded_data_test.go +++ b/record/blinded_data_test.go @@ -79,7 +79,6 @@ func TestBlindedDataEncoding(t *testing.T) { } for _, testCase := range tests { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() @@ -143,7 +142,6 @@ func TestBlindedDataFinalHopEncoding(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/record/record_test.go b/record/record_test.go index 45faa9f73..92902fa31 100644 --- a/record/record_test.go +++ b/record/record_test.go @@ -73,7 +73,6 @@ var recordEncDecTests = []recordEncDecTest{ // the original record matches the decoded record. func TestRecordEncodeDecode(t *testing.T) { for _, test := range recordEncDecTests { - test := test t.Run(test.name, func(t *testing.T) { r := test.encRecord() r2 := test.decRecord() diff --git a/routing/additional_edge_test.go b/routing/additional_edge_test.go index 0324e2e10..34fd2197a 100644 --- a/routing/additional_edge_test.go +++ b/routing/additional_edge_test.go @@ -68,7 +68,6 @@ func TestIntermediatePayloadSize(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/routing/bandwidth_test.go b/routing/bandwidth_test.go index b7f6e3f13..ff5529f34 100644 --- a/routing/bandwidth_test.go +++ b/routing/bandwidth_test.go @@ -102,7 +102,6 @@ func TestBandwidthManager(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { g := newMockGraph(t) diff --git a/routing/blindedpath/blinded_path_test.go b/routing/blindedpath/blinded_path_test.go index 0020f381c..3f4cb7597 100644 --- a/routing/blindedpath/blinded_path_test.go +++ b/routing/blindedpath/blinded_path_test.go @@ -161,7 +161,6 @@ func TestApplyBlindedPathPolicyBuffer(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -351,7 +350,6 @@ func TestPadBlindedHopInfo(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/routing/blinding_test.go b/routing/blinding_test.go index 0a8846adb..2ca9b631d 100644 --- a/routing/blinding_test.go +++ b/routing/blinding_test.go @@ -64,7 +64,6 @@ func TestBlindedPathValidation(t *testing.T) { } for _, testCase := range tests { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/routing/integrated_routing_test.go b/routing/integrated_routing_test.go index 9636b10f7..035c228fd 100644 --- a/routing/integrated_routing_test.go +++ b/routing/integrated_routing_test.go @@ -270,7 +270,6 @@ func TestBadFirstHopHint(t *testing.T) { // TestMppSend tests that a payment can be completed using multiple shards. func TestMppSend(t *testing.T) { for _, testCase := range mppTestCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { testMppSend(t, &testCase) diff --git a/routing/localchans/manager_test.go b/routing/localchans/manager_test.go index c48e61641..92d8ce051 100644 --- a/routing/localchans/manager_test.go +++ b/routing/localchans/manager_test.go @@ -359,7 +359,6 @@ func TestManager(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { currentPolicy = test.currentPolicy channelSet = test.channelSet diff --git a/routing/missioncontrol_store_test.go b/routing/missioncontrol_store_test.go index 889dca071..9cfd118a0 100644 --- a/routing/missioncontrol_store_test.go +++ b/routing/missioncontrol_store_test.go @@ -276,7 +276,6 @@ func BenchmarkMissionControlStoreFlushing(b *testing.B) { const testMaxRecords = 1000 for _, tc := range tests { - tc := tc name := fmt.Sprintf("%v additional results", tc) b.Run(name, func(b *testing.B) { h := newMCStoreTestHarness( diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index 85689ef9e..9bf03637a 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -899,7 +899,6 @@ func TestPathFinding(t *testing.T) { // Run with graph cache enabled. for _, tc := range testCases { - tc := tc t.Run("cache=true/"+tc.name, func(tt *testing.T) { tt.Parallel() @@ -911,7 +910,6 @@ func TestPathFinding(t *testing.T) { // And with the DB fallback to make sure everything works the same // still. for _, tc := range testCases { - tc := tc t.Run("cache=false/"+tc.name, func(tt *testing.T) { tt.Parallel() @@ -1686,7 +1684,6 @@ func TestNewRoute(t *testing.T) { }} for _, testCase := range testCases { - testCase := testCase // Overwrite the final hop's features if the test requires a // custom feature vector. @@ -2804,7 +2801,6 @@ func runProbabilityRouting(t *testing.T, useCache bool) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { testProbabilityRouting( @@ -3717,7 +3713,6 @@ func TestLastHopPayloadSize(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/routing/payment_lifecycle_test.go b/routing/payment_lifecycle_test.go index 564942d32..3405821a2 100644 --- a/routing/payment_lifecycle_test.go +++ b/routing/payment_lifecycle_test.go @@ -574,7 +574,6 @@ func TestDecideNextStep(t *testing.T) { } for _, tc := range testCases { - tc := tc // Create a test paymentLifecycle. p, _ := newTestPaymentLifecycle(t) diff --git a/routing/payment_session_test.go b/routing/payment_session_test.go index 0bc0b6dcb..7ad44b8be 100644 --- a/routing/payment_session_test.go +++ b/routing/payment_session_test.go @@ -55,7 +55,6 @@ func TestValidateCLTVLimit(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase success := t.Run(testCase.name, func(t *testing.T) { err := ValidateCLTVLimit( diff --git a/routing/probability_apriori_test.go b/routing/probability_apriori_test.go index b7df8ae6e..0527d2d41 100644 --- a/routing/probability_apriori_test.go +++ b/routing/probability_apriori_test.go @@ -315,7 +315,6 @@ func TestCapacityCutoff(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/routing/probability_bimodal_test.go b/routing/probability_bimodal_test.go index 57590a865..b7ecda213 100644 --- a/routing/probability_bimodal_test.go +++ b/routing/probability_bimodal_test.go @@ -239,7 +239,6 @@ func TestSuccessProbability(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -369,7 +368,6 @@ func TestIntegral(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -671,7 +669,6 @@ func TestComputeProbability(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() @@ -748,7 +745,6 @@ func TestLocalPairProbability(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/routing/route/route_test.go b/routing/route/route_test.go index 83cfc0749..b7d104d74 100644 --- a/routing/route/route_test.go +++ b/routing/route/route_test.go @@ -255,7 +255,6 @@ func TestBlindedHops(t *testing.T) { } for _, testCase := range tests { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() @@ -358,7 +357,6 @@ func TestPayloadSize(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/routing/router_test.go b/routing/router_test.go index e14ac199f..535e4db80 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -1423,8 +1423,6 @@ func TestSendToRouteStructuredError(t *testing.T) { } for failIndex, errorType := range testCases { - failIndex := failIndex - errorType := errorType t.Run(fmt.Sprintf("%T", errorType), func(t *testing.T) { // We'll modify the SendToSwitch method so that it @@ -2086,7 +2084,6 @@ func TestInboundOutbound(t *testing.T) { } for _, tc := range tests { - tc := tc t.Run(tc.name, func(tt *testing.T) { testInboundOutboundFee( @@ -2692,7 +2689,6 @@ func TestNewRouteRequest(t *testing.T) { } for _, testCase := range testCases { - testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() diff --git a/routing/unified_edges_test.go b/routing/unified_edges_test.go index 25c8e9220..6faf2efe7 100644 --- a/routing/unified_edges_test.go +++ b/routing/unified_edges_test.go @@ -224,7 +224,6 @@ func TestNodeEdgeUnifier(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/sweep/aggregator_test.go b/sweep/aggregator_test.go index 2cb89bdc3..41d0b44fa 100644 --- a/sweep/aggregator_test.go +++ b/sweep/aggregator_test.go @@ -370,7 +370,6 @@ func TestBudgetAggregatorCreateInputSets(t *testing.T) { // Iterate over the test cases. for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Setup the mocks. diff --git a/sweep/fee_bumper_test.go b/sweep/fee_bumper_test.go index d697f906b..cccb9b422 100644 --- a/sweep/fee_bumper_test.go +++ b/sweep/fee_bumper_test.go @@ -220,7 +220,6 @@ func TestBumpRequestMaxFeeRateAllowed(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Check the method under test. @@ -503,7 +502,6 @@ func TestCreateAndCheckTx(t *testing.T) { } for _, tc := range testCases { - tc := tc r := &monitorRecord{ req: tc.req, @@ -674,7 +672,6 @@ func TestCreateRBFCompliantTx(t *testing.T) { var requestCounter atomic.Uint64 for _, tc := range testCases { - tc := tc rid := requestCounter.Add(1) @@ -798,7 +795,6 @@ func TestTxPublisherBroadcast(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { tc.setupMock() @@ -931,7 +927,6 @@ func TestRemoveResult(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { requestID := tc.setupRecord() diff --git a/sweep/fee_function_test.go b/sweep/fee_function_test.go index a55ce79a7..d97308444 100644 --- a/sweep/fee_function_test.go +++ b/sweep/fee_function_test.go @@ -258,7 +258,6 @@ func TestLinearFeeFunctionFeeRateAtPosition(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/sweep/sweeper_test.go b/sweep/sweeper_test.go index d97fd9925..917119e00 100644 --- a/sweep/sweeper_test.go +++ b/sweep/sweeper_test.go @@ -1043,7 +1043,6 @@ func TestMonitorFeeBumpResult(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Setup the testing result channel. diff --git a/sweep/txgenerator_test.go b/sweep/txgenerator_test.go index 3f2051646..bedb3e707 100644 --- a/sweep/txgenerator_test.go +++ b/sweep/txgenerator_test.go @@ -134,7 +134,6 @@ func TestWeightEstimatorUnknownScript(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testUnknownScriptInner( t, test.pkscript, test.expectFail, diff --git a/sweep/walletsweep_test.go b/sweep/walletsweep_test.go index c7a5dfc22..b6bed3b9b 100644 --- a/sweep/walletsweep_test.go +++ b/sweep/walletsweep_test.go @@ -126,7 +126,6 @@ func TestFeeEstimateInfo(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { // Setup the mockers if specified. diff --git a/tls_manager_test.go b/tls_manager_test.go index 541b123c4..9cb88c264 100644 --- a/tls_manager_test.go +++ b/tls_manager_test.go @@ -428,7 +428,6 @@ func TestGenerateCertPairWithPartialFiles(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/blob/justice_kit_test.go b/watchtower/blob/justice_kit_test.go index 0d23e2e0f..0934c4e09 100644 --- a/watchtower/blob/justice_kit_test.go +++ b/watchtower/blob/justice_kit_test.go @@ -326,7 +326,6 @@ func TestJusticeKitRemoteWitnessConstruction(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { testJusticeKitRemoteWitnessConstruction(t, test) }) @@ -485,7 +484,6 @@ func TestJusticeKitToLocalWitnessConstruction(t *testing.T) { }, } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtclient/backup_task_internal_test.go b/watchtower/wtclient/backup_task_internal_test.go index 62d760946..afdb4545c 100644 --- a/watchtower/wtclient/backup_task_internal_test.go +++ b/watchtower/wtclient/backup_task_internal_test.go @@ -552,7 +552,6 @@ func TestBackupTask(t *testing.T) { } for _, test := range backupTaskTests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtclient/queue_test.go b/watchtower/wtclient/queue_test.go index a8494c216..66fe20c2a 100644 --- a/watchtower/wtclient/queue_test.go +++ b/watchtower/wtclient/queue_test.go @@ -61,7 +61,6 @@ func TestDiskOverflowQueue(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(tt *testing.T) { tt.Parallel() diff --git a/watchtower/wtdb/migration1/client_db_test.go b/watchtower/wtdb/migration1/client_db_test.go index acae177ad..d75503d67 100644 --- a/watchtower/wtdb/migration1/client_db_test.go +++ b/watchtower/wtdb/migration1/client_db_test.go @@ -94,7 +94,6 @@ func TestMigrateTowerToSessionIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { // Before the migration we have a sessions bucket. diff --git a/watchtower/wtdb/migration2/client_db_test.go b/watchtower/wtdb/migration2/client_db_test.go index c1436184f..b74c00f11 100644 --- a/watchtower/wtdb/migration2/client_db_test.go +++ b/watchtower/wtdb/migration2/client_db_test.go @@ -69,7 +69,6 @@ func TestMigrateClientChannelDetails(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtdb/migration3/client_db_test.go b/watchtower/wtdb/migration3/client_db_test.go index a2fc8aedf..8cd3796aa 100644 --- a/watchtower/wtdb/migration3/client_db_test.go +++ b/watchtower/wtdb/migration3/client_db_test.go @@ -83,7 +83,6 @@ func TestMigrateChannelIDIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtdb/migration4/client_db_test.go b/watchtower/wtdb/migration4/client_db_test.go index 267cfe17d..917b01dcc 100644 --- a/watchtower/wtdb/migration4/client_db_test.go +++ b/watchtower/wtdb/migration4/client_db_test.go @@ -226,7 +226,6 @@ func TestMigrateAckedUpdates(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtdb/migration5/client_db_test.go b/watchtower/wtdb/migration5/client_db_test.go index a0a67e5f5..ec29dfdb0 100644 --- a/watchtower/wtdb/migration5/client_db_test.go +++ b/watchtower/wtdb/migration5/client_db_test.go @@ -95,7 +95,6 @@ func TestCompleteTowerToSessionIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtdb/migration6/client_db_test.go b/watchtower/wtdb/migration6/client_db_test.go index c4928e2f9..9b3880f06 100644 --- a/watchtower/wtdb/migration6/client_db_test.go +++ b/watchtower/wtdb/migration6/client_db_test.go @@ -81,7 +81,6 @@ func TestMigrateSessionIDIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/watchtower/wtdb/migration7/client_db_test.go b/watchtower/wtdb/migration7/client_db_test.go index 40eeec5b0..2480b27ab 100644 --- a/watchtower/wtdb/migration7/client_db_test.go +++ b/watchtower/wtdb/migration7/client_db_test.go @@ -112,7 +112,6 @@ func TestMigrateChannelToSessionIndex(t *testing.T) { } for _, test := range tests { - test := test t.Run(test.name, func(t *testing.T) { t.Parallel() diff --git a/zpay32/invoice_internal_test.go b/zpay32/invoice_internal_test.go index 22434a99b..c2729e8c6 100644 --- a/zpay32/invoice_internal_test.go +++ b/zpay32/invoice_internal_test.go @@ -834,7 +834,6 @@ func TestParseTaggedFields(t *testing.T) { }, } for _, tc := range tests { - tc := tc // pin t.Run(tc.name, func(t *testing.T) { var invoice Invoice gotErr := parseTaggedFields(&invoice, tc.data, netParams) diff --git a/zpay32/invoice_test.go b/zpay32/invoice_test.go index bfa1539f3..cec6bfd74 100644 --- a/zpay32/invoice_test.go +++ b/zpay32/invoice_test.go @@ -901,7 +901,6 @@ func TestDecodeEncode(t *testing.T) { } for i, test := range tests { - test := test t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel() @@ -1050,7 +1049,6 @@ func TestNewInvoice(t *testing.T) { } for i, test := range tests { - test := test t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel()