Skip to content

refactor: fix variable shadowing and improve type assertion safety ac…#124

Merged
0x5487 merged 9 commits intomainfrom
refactor/lint-issue-01
Apr 1, 2026
Merged

refactor: fix variable shadowing and improve type assertion safety ac…#124
0x5487 merged 9 commits intomainfrom
refactor/lint-issue-01

Conversation

@0x5487
Copy link
Copy Markdown
Collaborator

@0x5487 0x5487 commented Mar 31, 2026

…ross multiple packages

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 67.34955% with 255 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/variable/pkg.go 57.62% 17 Missing and 8 partials ⚠️
pkg/gateway/pkg.go 33.33% 22 Missing and 2 partials ⚠️
internal/pkg/runtime/zero.go 18.51% 22 Missing ⚠️
internal/pkg/runtime/controlplane.go 30.00% 11 Missing and 10 partials ⚠️
pkg/config/pkg.go 56.81% 16 Missing and 3 partials ⚠️
pkg/gateway/upstream.go 66.00% 17 Missing ⚠️
pkg/proxy/grpc/proxy.go 63.15% 10 Missing and 4 partials ⚠️
pkg/proxy/http/proxy.go 55.17% 13 Missing ⚠️
pkg/gateway/service.go 74.35% 9 Missing and 1 partial ⚠️
internal/pkg/runtime/worker_fd.go 42.85% 5 Missing and 3 partials ⚠️
... and 24 more
Files with missing lines Coverage Δ
internal/pkg/consistent/consistent.go 93.81% <100.00%> (ø)
internal/pkg/hzadaptor/request.go 95.55% <100.00%> (+0.20%) ⬆️
internal/pkg/runtime/keepalive.go 100.00% <100.00%> (ø)
internal/pkg/runtime/procname_linux.go 75.00% <100.00%> (ø)
pkg/balancer/chash/hashing.go 89.36% <100.00%> (ø)
pkg/balancer/pkg.go 0.00% <ø> (ø)
pkg/balancer/random/random.go 100.00% <100.00%> (ø)
pkg/balancer/roundrobin/round_robin.go 100.00% <100.00%> (ø)
pkg/balancer/weighted/weighted.go 88.09% <100.00%> (ø)
pkg/config/error.go 100.00% <ø> (ø)
... and 76 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request focuses on improving code robustness and maintainability by addressing potential runtime panics and variable shadowing. Key changes include implementing safe type assertions using the 'ok' pattern across multiple packages, renaming error variables to avoid shadowing, and pre-declaring variables to clarify scope. Additionally, the .golangci.yml configuration was updated to include new linters such as lll, noinlineerr, and nlreturn. I have no feedback to provide.

@0x5487
Copy link
Copy Markdown
Collaborator Author

0x5487 commented Apr 1, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to resolve linting warnings, specifically variable shadowing, while improving code documentation and safety. It introduces enums for operational modes and adds comments to exported entities. However, the reviewer noted several critical compilation errors caused by calling a non-existent Go method on sync.WaitGroup. Feedback also highlights a regression in panic recovery during server shutdown and advises against disabling essential linters in .golangci.yml, as it contradicts the PR's objective of improving code quality.

0x5487 and others added 4 commits April 1, 2026 12:06
@0x5487 0x5487 merged commit 70a99c6 into main Apr 1, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants