refactor(modernize): apply safe modernize fixes#861
Conversation
|
@p3ddd please fix linter failed |
nikolasdehor
left a comment
There was a problem hiding this comment.
Clean mechanical modernization pass. All changes are behavior-preserving:
for range Nreplacingfor i := 0; i < N; i++** (Go 1.22+) -- correct when the loop variable was unusedslices.Contains/slices.Sort/slices.ContainsFuncreplacing manual search loops -- correct, more readablestrings.Cut/strings.CutPrefix/strings.CutSuffixreplacingstrings.HasPrefix+strings.TrimPrefixpatterns -- correct, avoids the double-scanmaps.Copyreplacing manual map iteration -- correctstrings.Builderreplacing string concatenation -- correct, avoids quadratic allocation inparseResponse,listJobs, andNormalizeAgentIDtestmax()builtin replacing manual min/max patterns -- correct (Go 1.21+)wg.Go()replacingwg.Add(1)+go func()-- correct (sync.WaitGroup.Go is Go 1.25+, and picoclaw uses Go 1.25)
The omitzero exclusion is sensible since it changes JSON serialization semantics.
All tests passing per the evidence. LGTM.
|
@nikolasdehor I’ve resolved the merge conflicts. Could you please approve/run the workflows for this fork PR when convenient? Thank you very much. |
|
@yinwm CI is now green and conflicts are resolved. This PR is ready to merge when you have time. Thanks! |
|
should we add a step in CI to check this automatically? |
|
@p3ddd Clean modernize pass. Keeping the codebase up to date with newer Go patterns and stdlib improvements without changing behavior is valuable maintenance work that often gets overlooked. We're building a PicoClaw Dev Group on Discord for contributors to connect and collaborate. If you'd like to join, send an email to |
refactor(modernize): apply safe modernize fixes
refactor(modernize): apply safe modernize fixes
📝 Description
This PR applies safe, mechanical modernization fixes across the codebase using
modernize.Scope is limited to non-functional refactors (loop/style/stdlib modernizations), with no API or behavior changes intended.
This is a follow-up maintenance cleanup complementary to #435.
Not included in this PR:
omitempty->omitzerobehavior-changing alternatives.Reproducibility:
modernize -fix -omitzero=false ./...🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
N/A
📚 Technical Context (Skip for Docs)
modernizesuggestions to address.omitempty->omitzerois intentionally deferred because it may change JSON serialization semantics.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
☑️ Checklist