fix: resolve all lint issues to a clean golangci-lint run #11
No reviewers
Labels
No labels
code-review
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
norobo/webstream!11
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lint-clean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
golangci-lint runnow reports 0 issues (was 49 onmain). All 49 findings fixed in seven files; no//nolintdirectives added.What changed
server.go(19 findings across 5 linter families)NewServermoved beforeacquire(constructor-first);acquire,release,residencyLoop,evictIdleStreamsmoved after the exportedClose(exported-before-unexported).acquire— rewrote the single-flight retry loop so thefor {}body is a pureselect(first case<-ctx.Done(), work indefault:), satisfying therequire-select-only-bodyrule.Server.finishLoadsoacquire'sif !okbranch stays shallow (complexity 1, was 5).s.acquire(...)was discarded (each handler returned a hardcodedErrStreamNotFound/ErrConsumerNotFoundor a no-opresponse{}). NowgetConsumer/createConsumer/publishpropagate the actual error; the handlers that deliberately remap toErrConsumerNotFoundor no-op (leaseCheck,pull,ack,releaseConsumerLease,deleteConsumer) log it at debug vias.logger.LogAttrs.store.go(13 findings)sweepStream,segmentLastTS).int64→uint64info.Size()conversions guarded withsize >= 0.os.Root/os.Fileerrors indeleteSegmentnow wrapped.func(a, b budgetSegment)→left, right;d→logFile.rewindAppendLockederror logged on failed append/sync instead of_ =blank.stream_state.go(2 unparam)base/movedreturns fromappendDedup(every caller used onlyrec+duplicate).nilconsumersparameter fromnewStreamStateWith(the map is now allocated inside).Tests (bench_test, lazy_residency_test, recovery_test, store_test)
wg.Go(Go 1.27WaitGroup), replacingwg.Add(1)+go+wg.Done.time.Sleepin loops;ctx.Done()-guarded channel ops (chanctx).benchRoothelper for benchmarkroot.Close(errcheck).t.Parallel()(paralleltest).unnecessary-format(t.Fatalf→t.Fatal),epoch-naming(now→nowNano), and the error-branchf.Close()calls in tests (dropped — the branch alreadyt.Fatalfs, so the close was redundant).Verification
The full-suite
racedetector test ./...failure (TestLoopbackLifecycle,TestReconciliationPagesThroughAPeersStreams) is pre-existing: I reproduced the identical ~4100DATA RACEwarnings on a cleanorigin/mainworktree. It lives inrpc_stream.go/conn.go/stream.go, none of which this PR touches.