chore: use any over interface{} - #79
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReplace all occurrences of interface{} with the Go 1.18 alias any to modernize the codebase, updating function signatures, variable declarations, and callback return types across database, tests, gRPC server, and JWT parsing logic. Class diagram for updated function signatures using 'any' instead of 'interface{}'classDiagram
class TxDB {
+Exec(ctx context.Context, sql string, args ...any) pgconn.CommandTag
+Query(ctx context.Context, sql string, args ...any) pgx.Rows
+QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}
class recoveryHandler {
+recoveryHandler(p any) error
}
class ParseToken {
+ParseToken(tokenString string, secret []byte) (*entity.Claims, error)
}
class jwtParseWithClaimsCallback {
+func(token *jwt.Token) (any, error)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughReplaced Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧬 Code graph analysis (1)service/auth/pkg/sdk/auth/auth.go (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (5)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter" 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. Comment |
PR Compliance Guide 🔍(Compliance updated until commit 0715feb)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 0715feb
|
||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #79 +/- ##
=======================================
Coverage 58.63% 58.63%
=======================================
Files 58 58
Lines 1987 1987
=======================================
Hits 1165 1165
Misses 788 788
Partials 34 34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
User description
Summary
use any over interface{}
Description
use any over interface{}
PR Type
Enhancement
Description
Replace
interface{}withanykeyword throughout codebaseUpdate function signatures in database, gRPC, and auth packages
Modernize Go code to use Go 1.18+ syntax conventions
Diagram Walkthrough
flowchart LR A["interface{} usage"] -- "replaced with" --> B["any keyword"] B -- "applied to" --> C["Database functions"] B -- "applied to" --> D["gRPC handlers"] B -- "applied to" --> E["Auth & test utilities"]File Walkthrough
db.go
Update database function signatures to use anypkg/sdk/database/postgres/db.go
interface{}withanyinExec()method signatureinterface{}withanyinQuery()method signatureinterface{}withanyinQueryRow()method signatureserver.go
Update gRPC recovery handler to use anypkg/sdk/grpc/server/server.go
interface{}withanyinrecoveryHandler()parameter typelogin_test.go
Update test helper JSON comparison variablesservice/auth/features/login_test.go
interface{}withanyforexpectedvariable declarationinterface{}withanyforactualvariable declarationauth.go
Update JWT token parser callback signatureservice/auth/pkg/sdk/auth/auth.go
interface{}withanyin JWT token parsing callback functionreturn type
user_test.go
Update test helper JSON comparison variablesservice/user/features/user_test.go
interface{}withanyforexpectedvariable declarationinterface{}withanyforactualvariable declarationSummary by CodeRabbit