ci: support Go 1.26 linting #77

Merged
pokebedrock-bot merged 2 commits from manish/fix-go126-golangci-lint into main 2026-07-10 18:14:34 +00:00
pokebedrock-bot commented 2026-07-08 18:45:04 +00:00 (Migrated from github.com)

Summary

  • update golangci-lint to a release binary built with Go 1.26
  • clean up existing lint findings exposed once the linter can start
  • keep behavior unchanged while reducing helper complexity in AFK and VPN code

Verification

  • downloaded the released golangci-lint v2.12.2 binary and ran golangci-lint run --timeout=5m
  • go test ./...

This unblocks the current Dependabot PRs, which are all failing before lint analysis with:

can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26.0)

Summary by CodeRabbit

  • Chores
    • Updated the automated linting setup to use a newer version.
  • Refactor
    • Improved AFK warning flow and VPN IP handling for clearer, maintainable logic, including faster outcomes for whitelisted VPN addresses.
    • Optimized how button type lists are assembled for efficiency.
  • Documentation
    • Corrected minor spelling/wording in in-app comments.
## Summary - update golangci-lint to a release binary built with Go 1.26 - clean up existing lint findings exposed once the linter can start - keep behavior unchanged while reducing helper complexity in AFK and VPN code ## Verification - downloaded the released golangci-lint v2.12.2 binary and ran `golangci-lint run --timeout=5m` - `go test ./...` This unblocks the current Dependabot PRs, which are all failing before lint analysis with: ```text can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26.0) ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated the automated linting setup to use a newer version. * **Refactor** * Improved AFK warning flow and VPN IP handling for clearer, maintainable logic, including faster outcomes for whitelisted VPN addresses. * Optimized how button type lists are assembled for efficiency. * **Documentation** * Corrected minor spelling/wording in in-app comments. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2026-07-08 18:45:23 +00:00 (Migrated from github.com)

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f261b7a-707f-4eb3-b36a-fd401b1acdb3

📥 Commits

Reviewing files that changed from the base of the PR and between 47e9b29a96 and 57bf61140f.

📒 Files selected for processing (1)
  • gobds/service/vpn/service.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • gobds/service/vpn/service.go

📝 Walkthrough

Walkthrough

This PR bumps the golangci-lint-action version, fixes two comment typos, refactors AFK warning logic in gobds/afk.go into two helper methods, refactors VPN CheckIP whitelist/rate-limit logic into two helper methods, and changes ButtonTypes() to preallocate its result slice.

Changes

Refactors and minor updates

Layer / File(s) Summary
AFK warning logic extraction
gobds/afk.go
Inline soft and final AFK warning loops in evaluateAFK are replaced with calls to new warnAFKSessions and warnFinalAFKSessions helper methods, with an added infra import.
VPN CheckIP refactor
gobds/service/vpn/service.go
CheckIP now delegates whitelist checking and rate-limit checking to new isWhitelisted and rateLimitActive helper methods instead of inline logic.
Slice preallocation and minor fixes
gobds/block/button_type.go, .github/workflows/lint.yml, filterlog.go, gobds/status.go
ButtonTypes() preallocates its slice and appends entries; golangci-lint-action version is bumped; comment typos are corrected in filterlog.go and gobds/status.go.

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | 5
Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly matches the main change: updating CI linting support for Go 1.26.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/smell-of-curry/gobds/pull/77?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro **Run ID**: `5f261b7a-707f-4eb3-b36a-fd401b1acdb3` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 47e9b29a96c3af82ae2e2ef5b17a8f5fd22692e5 and 57bf61140f89766ded543f5cb9e944b1db959aa4. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `gobds/service/vpn/service.go` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * gobds/service/vpn/service.go </details> </details> --- <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough This PR bumps the golangci-lint-action version, fixes two comment typos, refactors AFK warning logic in gobds/afk.go into two helper methods, refactors VPN CheckIP whitelist/rate-limit logic into two helper methods, and changes ButtonTypes() to preallocate its result slice. ### Changes **Refactors and minor updates** |Layer / File(s)|Summary| |---|---| |**AFK warning logic extraction** <br> `gobds/afk.go`|Inline soft and final AFK warning loops in `evaluateAFK` are replaced with calls to new `warnAFKSessions` and `warnFinalAFKSessions` helper methods, with an added `infra` import.| |**VPN CheckIP refactor** <br> `gobds/service/vpn/service.go`|`CheckIP` now delegates whitelist checking and rate-limit checking to new `isWhitelisted` and `rateLimitActive` helper methods instead of inline logic.| |**Slice preallocation and minor fixes** <br> `gobds/block/button_type.go`, `.github/workflows/lint.yml`, `filterlog.go`, `gobds/status.go`|`ButtonTypes()` preallocates its slice and appends entries; `golangci-lint-action` version is bumped; comment typos are corrected in `filterlog.go` and `gobds/status.go`.| **Estimated code review effort:** 2 (Simple) | ~12 minutes </details> <!-- walkthrough_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :--------------------------------------------------------------------------------------------------------- | | Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | ✅ Passed | The title clearly matches the main change: updating CI linting support for Go 1.26. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> <details> <summary>🧪 Generate unit tests (beta)</summary> - [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create PR with unit tests </details> </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=smell-of-curry/gobds&utm_content=77)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2026-07-08 18:48:22 +00:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gobds/service/vpn/service.go`:
- Around line 50-55: The rate-limit error path in the service uses
s.rateLimitReset outside the mutex, creating a race with handleRateLimitHeaders
and potentially exposing a stale reset time. Update rateLimitActive to return
the captured reset value alongside the boolean so the check and timestamp come
from the same locked read, then use that returned value in the error formatting
at the call sites in the VPN service flow (including the other rate-limit branch
mentioned in the review).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c0972df-f884-47b5-a6fc-fb330ec349f2

📥 Commits

Reviewing files that changed from the base of the PR and between d9fab62fbb and 47e9b29a96.

📒 Files selected for processing (6)
  • .github/workflows/lint.yml
  • filterlog.go
  • gobds/afk.go
  • gobds/block/button_type.go
  • gobds/service/vpn/service.go
  • gobds/status.go
**Actionable comments posted: 1** <details> <summary>🤖 Prompt for all review comments with AI agents</summary> ``` Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@gobds/service/vpn/service.go`: - Around line 50-55: The rate-limit error path in the service uses s.rateLimitReset outside the mutex, creating a race with handleRateLimitHeaders and potentially exposing a stale reset time. Update rateLimitActive to return the captured reset value alongside the boolean so the check and timestamp come from the same locked read, then use that returned value in the error formatting at the call sites in the VPN service flow (including the other rate-limit branch mentioned in the review). ``` </details> <details> <summary>🪄 Autofix (Beta)</summary> Fix all unresolved CodeRabbit comments on this PR: - [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended) - [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes </details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro **Run ID**: `1c0972df-f884-47b5-a6fc-fb330ec349f2` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between d9fab62fbb4a3316e435f3efb8176eb9b6b8e5c9 and 47e9b29a96c3af82ae2e2ef5b17a8f5fd22692e5. </details> <details> <summary>📒 Files selected for processing (6)</summary> * `.github/workflows/lint.yml` * `filterlog.go` * `gobds/afk.go` * `gobds/block/button_type.go` * `gobds/service/vpn/service.go` * `gobds/status.go` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
coderabbitai[bot] (Migrated from github.com) commented 2026-07-08 18:48:20 +00:00

🩺 Stability & Availability | 🟡 Minor | Quick win

Unlocked read of s.rateLimitReset in rate-limit error message.

rateLimitActive() correctly checks s.rateLimitReset under the lock, but line 54 reads s.rateLimitReset again outside the lock to format the error. This is a data race with handleRateLimitHeaders (line 144), which writes s.rateLimitReset under s.mu. The downstream consumer in gobds/gobds.go:211 surfaces this error string directly to users, so a torn read could display a stale or inconsistent reset time.

Fix by returning the captured value from rateLimitActive:

 func (s *Service) rateLimitActive() bool {
+func (s *Service) rateLimitActive() (bool, time.Time) {
 	s.mu.Lock()
 	defer s.mu.Unlock()
-	return time.Now().Before(s.rateLimitReset)
+	return time.Now().Before(s.rateLimitReset), s.rateLimitReset
 }

And at the call site:

-	if s.rateLimitActive() {
-		return nil, fmt.Errorf("rate limit active, please wait until %v", s.rateLimitReset)
+	if active, reset := s.rateLimitActive(); active {
+		return nil, fmt.Errorf("rate limit active, please wait until %v", reset)
 	}

Also applies to: 125-129

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gobds/service/vpn/service.go` around lines 50 - 55, The rate-limit error path
in the service uses s.rateLimitReset outside the mutex, creating a race with
handleRateLimitHeaders and potentially exposing a stale reset time. Update
rateLimitActive to return the captured reset value alongside the boolean so the
check and timestamp come from the same locked read, then use that returned value
in the error formatting at the call sites in the VPN service flow (including the
other rate-limit branch mentioned in the review).

Addressed in commit 57bf611

_🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_ **Unlocked read of `s.rateLimitReset` in rate-limit error message.** `rateLimitActive()` correctly checks `s.rateLimitReset` under the lock, but line 54 reads `s.rateLimitReset` again outside the lock to format the error. This is a data race with `handleRateLimitHeaders` (line 144), which writes `s.rateLimitReset` under `s.mu`. The downstream consumer in `gobds/gobds.go:211` surfaces this error string directly to users, so a torn read could display a stale or inconsistent reset time. Fix by returning the captured value from `rateLimitActive`: ```diff func (s *Service) rateLimitActive() bool { +func (s *Service) rateLimitActive() (bool, time.Time) { s.mu.Lock() defer s.mu.Unlock() - return time.Now().Before(s.rateLimitReset) + return time.Now().Before(s.rateLimitReset), s.rateLimitReset } ``` And at the call site: ```diff - if s.rateLimitActive() { - return nil, fmt.Errorf("rate limit active, please wait until %v", s.rateLimitReset) + if active, reset := s.rateLimitActive(); active { + return nil, fmt.Errorf("rate limit active, please wait until %v", reset) } ``` Also applies to: 125-129 <details> <summary>🤖 Prompt for AI Agents</summary> ``` Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gobds/service/vpn/service.go` around lines 50 - 55, The rate-limit error path in the service uses s.rateLimitReset outside the mutex, creating a race with handleRateLimitHeaders and potentially exposing a stale reset time. Update rateLimitActive to return the captured reset value alongside the boolean so the check and timestamp come from the same locked read, then use that returned value in the error formatting at the call sites in the VPN service flow (including the other rate-limit branch mentioned in the review). ``` </details> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:0af0d662a62d15fbe797cda5 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 57bf611
Sign in to join this conversation.
No description provided.