Skip to content

Commit b894791

Browse files
committed
fix(linters): disable revive var-naming rule globally
Disables the revive var-naming rule to prevent false positives for internal packages (metrics, sync, version) that conflict with stdlib package names. Path-based exclusion rules were not working reliably due to golangci-lint issue #3717. Also removes now-unused nolint directives from batch.go and pool_test.go.
1 parent 471f9f3 commit b894791

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

.golangci.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@
5959
"gomoddirectives"
6060
],
6161
"text": "replacement are not allowed: github.com/joho/godotenv"
62-
},
63-
{
64-
"linters": [
65-
"revive"
66-
],
67-
"text": "var-naming: avoid package names that conflict with Go standard library package names",
68-
"path": "internal/(metrics|sync|version)/.*\\.go$"
6962
}
7063
],
7164
"uniq-by-line": true
@@ -224,6 +217,14 @@
224217
},
225218
"unparam": {
226219
"check-exported": false
220+
},
221+
"revive": {
222+
"rules": [
223+
{
224+
"name": "var-naming",
225+
"disabled": true
226+
}
227+
]
227228
}
228229
}
229230
},

internal/sync/batch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (bp *BatchProcessor) ProcessFiles(ctx context.Context, sourcePath string, j
105105
if err := g.Wait(); err != nil {
106106
// On error/cancellation, drain the result channel to prevent goroutine leaks
107107
go func() {
108-
for range resultChan { //nolint:revive // intentionally draining channel
108+
for range resultChan {
109109
}
110110
}()
111111
return nil, fmt.Errorf("batch processing failed: %w", err)
@@ -682,7 +682,7 @@ func (bp *BatchProcessor) ProcessFilesWithProgress(ctx context.Context, sourcePa
682682
if err := g.Wait(); err != nil {
683683
// On error/cancellation, drain the result channel to prevent goroutine leaks
684684
go func() {
685-
for range resultChan { //nolint:revive // intentionally draining channel
685+
for range resultChan {
686686
}
687687
}()
688688
return nil, fmt.Errorf("batch processing failed: %w", err)

internal/worker/pool_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func TestPoolBatchSubmitPartialFailure(t *testing.T) {
479479

480480
// Consume any pending results before shutdown to avoid deadlock
481481
go func() {
482-
for range pool.Results() { //nolint:revive // intentionally draining channel
482+
for range pool.Results() {
483483
}
484484
}()
485485

@@ -808,7 +808,7 @@ func TestSubmitAfterShutdown(t *testing.T) {
808808

809809
// Drain results in background
810810
go func() {
811-
for range pool.Results() { //nolint:revive // Intentionally draining channel
811+
for range pool.Results() {
812812
}
813813
}()
814814

@@ -829,7 +829,7 @@ func TestDoubleShutdown(t *testing.T) {
829829

830830
// Drain results in background
831831
go func() {
832-
for range pool.Results() { //nolint:revive // Intentionally draining channel
832+
for range pool.Results() {
833833
}
834834
}()
835835

@@ -856,7 +856,7 @@ func TestNilTask(t *testing.T) {
856856

857857
// Drain results in background
858858
go func() {
859-
for range pool.Results() { //nolint:revive // Intentionally draining channel
859+
for range pool.Results() {
860860
}
861861
}()
862862

0 commit comments

Comments
 (0)