Skip to content

chore: simplify, modernize (Go 1.26), update deps#108

Open
rustatian wants to merge 2 commits into
masterfrom
chore/cleanup-modernize-deps
Open

chore: simplify, modernize (Go 1.26), update deps#108
rustatian wants to merge 2 commits into
masterfrom
chore/cleanup-modernize-deps

Conversation

@rustatian
Copy link
Copy Markdown
Member

Applied fixes

Simplify (S) — 2 applied:

  • config.go: extracted parseDSN helper to deduplicate DSN validation logic shared between Valid() and Dialer() — was copy-pasted with identical error message
  • plugin.go: renamed local variable WholeCfgwholeCfg (unexported naming convention)

Modern Go (M) — 3 applied:

  • config.go:45 (Valid): strings.Split(Listen, "://") + len check → strings.Cut via parseDSN
  • config.go:66 (Dialer): same strings.Split + lenstrings.Cut via parseDSN
  • plugin.go:128: strings.TrimPrefix + strings.Index + slice → strings.Cut

Not applied (needs manual review)

  • R Med config.go:65Dialer() uses context.Background() instead of a caller-supplied context. Fixing this requires a signature change (Dialer(ctx context.Context)) and updating all call-sites; left for a dedicated change.

Deps

go get -u all && go mod tidy in both . and ./tests; go work sync — no version changes (all deps were already current).

Verification

go build ./...   ✓
go vet ./...     ✓
golangci-lint run → 0 issues  ✓
go test ./...    ✓ (no test files in main package; tests/ module passes)

- config.go: extract parseDSN helper (strings.Cut) to deduplicate DSN
  validation between Valid() and Dialer(); replace two strings.Split+len
  sites with the helper
- plugin.go: rename local WholeCfg → wholeCfg (unexported style);
  replace TrimPrefix+Index+slice with strings.Cut
Copilot AI review requested due to automatic review settings May 29, 2026 12:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Warning

Review limit reached

@rustatian, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 8 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 10688caf-fa49-4307-b203-0466231ea131

📥 Commits

Reviewing files that changed from the base of the PR and between 9091a87 and 3093e78.

📒 Files selected for processing (3)
  • config.go
  • plugin.go
  • tests/config_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/cleanup-modernize-deps

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 and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies and modernizes the RPC plugin by deduplicating DSN parsing/validation logic in Config and using newer strings.Cut-based parsing where applicable.

Changes:

  • Extracted parseDSN helper in config.go and reused it in Valid() and Dialer().
  • Renamed a local variable in plugin.go to follow unexported naming conventions and simplified service-name extraction using strings.Cut.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
config.go Adds parseDSN helper and reuses it for config validation and dialing.
plugin.go Minor naming cleanup and simplifies mount-path parsing for service reflection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.94%. Comparing base (9091a87) to head (3093e78).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #108      +/-   ##
==========================================
+ Coverage   61.80%   63.94%   +2.14%     
==========================================
  Files           3        3              
  Lines         144      147       +3     
==========================================
+ Hits           89       94       +5     
+ Misses         37       36       -1     
+ Partials       18       17       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

strings.Cut only splits on the first delimiter, so the parseDSN refactor
accepted inputs like tcp://host://port that the prior strings.Split(...);
len != 2 check rejected. Restore exactly-one-separator semantics and add a
regression test covering Valid() and Dialer().
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