Skip to content

chore: apply go fix modernizers - #1825

Open
AmanGIT07 wants to merge 2 commits into
mainfrom
chore/apply-go-fix
Open

chore: apply go fix modernizers#1825
AmanGIT07 wants to merge 2 commits into
mainfrom
chore/apply-go-fix

Conversation

@AmanGIT07

Copy link
Copy Markdown
Contributor

Summary

Applies Go 1.26's go fix across the repository at its fixed point — a second run produces no further changes — plus the small cleanups the fixer intentionally leaves behind.

Changes

  • interface{}any (~237 sites), pointer-helper calls → new(expr) (~231), manual loops → maps.Copy / slices.Contains (13), 3-clause loops → range-over-int (~10), goroutine boilerplate → sync.WaitGroup.Go (4) — 95 files, net −44 lines
  • Remove the five pointer helpers orphaned by the newexpr rewrite (every call site is now new(x))
  • go mod tidy (separate commit): golang.org/x/net moves to the indirect section — no first-party imports remain after refactor(server): serve unencrypted HTTP/2 natively #1818
  • Generated code is untouched (go fix skips it); no behavior changes

Test Plan

  • go build ./... and go vet ./... pass
  • make lint passes (0 issues)
  • make test passes (race detector, -count 2)
  • make e2e-test passes against live Postgres + SpiceDB containers
  • go fix -diff ./... is empty on the result (fixed point)

SQL Safety (if your PR touches *_repository.go or goqu.*)

  • Values flow through ? placeholders, goqu.Ex{}, or goqu.Record{} — never fmt.Sprintf or + building a query that gets executed.
  • ToSQL() callers capture and forward params (query, params, err := stmt.ToSQL(); db.…Context(ctx, …, query, params...)). Never query, _, err := ….
  • No ? placeholders inside single-quoted SQL literals in goqu.L (use make_interval(hours => ?)-style functions instead).
  • Any //nolint:forbidigo or // #nosec G20x annotation has a one-line justification on the same line that a reviewer can verify.

🤖 Generated with Claude Code

AmanGIT07 and others added 2 commits July 30, 2026 15:17
Go 1.26's go fix applied at its fixed point: interface{} to any,
pointer-helper calls to new(expr), manual loops to maps.Copy,
slices.Contains and range-over-int, and WaitGroup.Go where the shape
allows. The five pointer helpers orphaned by the rewrite are removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview Jul 30, 2026 9:48am

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Audit record exports now consistently include the created_at field, including when its value is empty.
  • Refactor

    • Modernized internal data handling and collection operations for improved consistency and maintainability.
    • Streamlined billing, checkout, subscription, invoice, customer, and product integrations without changing their workflows or public behavior.
    • Improved metadata copying and CSV export header processing.
  • Tests

    • Updated concurrency, billing, authentication, repository, and end-to-end test coverage to align with current language features and data representations.

Walkthrough

The pull request modernizes Go syntax and standard-library helper usage across billing integrations, audit and metadata handling, PostgreSQL repositories, utilities, and tests. Stripe pointer construction, interface{} aliases, map copying, slice operations, reflection, formatting, and loop forms are updated without changing most functional flows.

Changes

Go modernization

Layer / File(s) Summary
Billing and Stripe parameter construction
billing/..., test/e2e/testbench/stripe.go
Stripe parameters now use new(...) pointers across checkout, invoice, product, customer, and subscription flows; related expectations are updated.
Metadata, collection, and reflection helpers
core/..., pkg/..., internal/reconcile/...
any, maps.Copy, slices.Contains, strings.SplitSeq, reflect.TypeFor, and fmt.Appendf replace equivalent older forms.
Repository and test type updates
internal/store/postgres/..., internal/api/...
SQL parameters, scanner inputs, metadata maps, and fixtures now use any and []any; test loop and pointer helpers are simplified.
Audit serialization and end-to-end tests
core/auditrecord/models/models.go, test/e2e/..., go.mod
created_at is always serialized, e2e fixtures use modern types and loops, and golang.org/x/net is marked indirect.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: rohilsurana

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8def53cf-61b7-4192-81b0-e51fee272602

📥 Commits

Reviewing files that changed from the base of the PR and between 3b828eb and db6d3dd.

📒 Files selected for processing (96)
  • billing/checkout/service.go
  • billing/checkout/service_concurrent_test.go
  • billing/credit/service.go
  • billing/customer/service.go
  • billing/customer/service_concurrent_test.go
  • billing/customer/service_test.go
  • billing/invoice/service.go
  • billing/invoice/service_concurrent_test.go
  • billing/invoice/service_test.go
  • billing/product/service.go
  • billing/product/service_test.go
  • billing/subscription/service.go
  • billing/subscription/service_concurrent_test.go
  • billing/subscription/service_test.go
  • cmd/preferences.go
  • core/aggregates/orgbilling/service.go
  • core/aggregates/orgprojects/service.go
  • core/aggregates/orgtokens/service.go
  • core/aggregates/orgusers/service.go
  • core/audit/context.go
  • core/audit/logger.go
  • core/audit/service.go
  • core/audit/service_test.go
  • core/auditrecord/models/models.go
  • core/auditrecord/service.go
  • core/auditrecord/service_test.go
  • core/authenticate/service_test.go
  • core/authenticate/session/session.go
  • core/authenticate/strategy/oidc.go
  • core/event/service.go
  • core/invitation/service.go
  • core/membership/service.go
  • core/preference/preference.go
  • core/preference/validator.go
  • core/user/service.go
  • core/webhook/service.go
  • go.mod
  • internal/api/v1beta1connect/billing_invoice_test.go
  • internal/api/v1beta1connect/billing_usage_test.go
  • internal/api/v1beta1connect/policy_test.go
  • internal/api/v1beta1connect/resource_test.go
  • internal/reconcile/platformuser_reconciler_test.go
  • internal/reconcile/role_reconciler.go
  • internal/reconcile/role_reconciler_test.go
  • internal/reconcile/role_test.go
  • internal/store/postgres/audit_record.go
  • internal/store/postgres/audit_record_repository.go
  • internal/store/postgres/audit_record_repository_test.go
  • internal/store/postgres/billing_checkout_repository.go
  • internal/store/postgres/billing_customer_repository.go
  • internal/store/postgres/billing_customer_repository_test.go
  • internal/store/postgres/billing_invoice_repository.go
  • internal/store/postgres/billing_invoice_repository_test.go
  • internal/store/postgres/billing_product_repository.go
  • internal/store/postgres/billing_subscription_repository.go
  • internal/store/postgres/invitation.go
  • internal/store/postgres/invitation_repository.go
  • internal/store/postgres/kyc_repository.go
  • internal/store/postgres/org_billing_repository.go
  • internal/store/postgres/org_billing_repository_test.go
  • internal/store/postgres/org_invoices_repository.go
  • internal/store/postgres/org_invoices_repository_test.go
  • internal/store/postgres/org_pats_repository.go
  • internal/store/postgres/org_projects_repository.go
  • internal/store/postgres/org_projects_repository_test.go
  • internal/store/postgres/org_serviceuser_credentials_repository.go
  • internal/store/postgres/org_serviceuser_credentials_repository_test.go
  • internal/store/postgres/org_serviceuser_repository.go
  • internal/store/postgres/org_serviceuser_repository_test.go
  • internal/store/postgres/org_tokens_repository.go
  • internal/store/postgres/org_tokens_repository_test.go
  • internal/store/postgres/org_users_repository.go
  • internal/store/postgres/org_users_repository_test.go
  • internal/store/postgres/organization_repository.go
  • internal/store/postgres/policy_repository.go
  • internal/store/postgres/postgres_test.go
  • internal/store/postgres/project_users_repository.go
  • internal/store/postgres/project_users_repository_test.go
  • internal/store/postgres/user_orgs_repository.go
  • internal/store/postgres/user_orgs_repository_test.go
  • internal/store/postgres/user_projects_repository_test.go
  • internal/store/postgres/user_repository.go
  • internal/store/postgres/user_repository_test.go
  • internal/store/postgres/userpat_repository_test.go
  • internal/store/postgres/webhook_endpoint.go
  • internal/store/spicedb/relation_repository.go
  • pkg/file/file.go
  • pkg/metadata/metadata.go
  • pkg/utils/pointers.go
  • pkg/utils/rql.go
  • pkg/utils/slice.go
  • test/e2e/regression/authentication_test.go
  • test/e2e/regression/billing_test.go
  • test/e2e/regression/serviceusers_test.go
  • test/e2e/testbench/helper.go
  • test/e2e/testbench/stripe.go

Comment thread internal/store/postgres/audit_record.go
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.

1 participant