Skip to content

chore: modernize code to Go 1.26 idioms - #1586

Merged
krishankumar01 merged 4 commits into
masterfrom
krishankumar01/go-modernize
Oct 21, 2026
Merged

krishankumar01 merged 4 commits into
masterfrom
krishankumar01/go-modernize

Conversation

@krishankumar01

@krishankumar01 krishankumar01 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

The framework now requires Go 1.26, but a lot of the code is still written the pre-1.21 way. This PR moves it to the newer standard library features, which makes the code shorter and easier to read.

  • Use b.Loop() in benchmarks and drop the manual timer calls. The mail benchmark no longer runs one extra loop (i <= b.N).
  • Use wg.Go instead of Add/go/Done in the queue worker, process pool and log rotation.
  • Use math/rand/v2 in collect and docker helpers. This removes the shared generator and its mutex.
  • Replace hand-written loops with slices, maps, strings.Cut/SplitSeq, min/max and reflect.TypeFor.
  • Replace sort with slices.Sort/SortFunc. Help output uses a stable sort now, so flags stay in name order inside each group.
  • Use for range n loops, slices.Sorted(maps.Keys(m)) and slices.Clone in production code.
  • Use new(x) everywhere and deprecate convert.Pointer and translation.Bool. Both still work and will be removed in a future version.

@krishankumar01
krishankumar01 requested a review from a team as a code owner October 20, 2026 20:53
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.55556% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.84%. Comparing base (bc9e320) to head (7a667cb).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
database/schema/column.go 37.50% 5 Missing ⚠️
support/collect/collection.go 73.33% 4 Missing ⚠️
database/schema/index.go 0.00% 3 Missing ⚠️
mail/mail.go 25.00% 3 Missing ⚠️
database/gorm/query.go 83.33% 2 Missing ⚠️
validation/rules.go 80.00% 2 Missing ⚠️
console/cli_context.go 0.00% 1 Missing ⚠️
console/cli_helper.go 90.90% 1 Missing ⚠️
database/db/utils.go 66.66% 1 Missing ⚠️
database/factory/factory.go 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1586      +/-   ##
==========================================
- Coverage   72.90%   72.84%   -0.06%     
==========================================
  Files         412      412              
  Lines       26893    26817      -76     
==========================================
- Hits        19606    19536      -70     
+ Misses       7285     7280       -5     
+ Partials        2        1       -1     

☔ View full report in Codecov by Harness.
📢 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.

@hwbrzzl hwbrzzl 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.

Awesome

@krishankumar01
krishankumar01 merged commit 84af91f into master Oct 21, 2026
22 checks passed
@krishankumar01
krishankumar01 deleted the krishankumar01/go-modernize branch October 21, 2026 09:51
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