Modernize Go code with go fix - #916
Conversation
There was a problem hiding this comment.
Pull request overview
Applies go fix-style modernizations across the repo, adopting newer standard-library helpers and language constructs to reduce boilerplate while aiming to preserve behavior.
Changes:
- Replace manual map-copy loops and map collection with
maps.Copy/maps.Collect. - Modernize loops and string processing with newer helpers (e.g.,
for i := range N,strings.CutPrefix,strings.SplitSeq,slices.Backward,slices.Contains). - Update concurrency patterns in tests/utility code using newer WaitGroup helpers (e.g.,
wg.Go).
Show a summary per file
| File | Description |
|---|---|
| workflow/internal/workflowtest/recording_tracer.go | Uses maps.Copy to simplify trace-context copying. |
| workflow/internal/execution/inputwaiter_test.go | Modernizes fixed-count loop with range over an integer. |
| workflow/internal/execution/edgerunner_observability_test.go | Uses newer WaitGroup helper and newer pointer creation patterns in tests. |
| workflow/inproc/events_test.go | Modernizes goroutine-spawning loop with integer range. |
| workflow/inproc/checkpoint_test.go | Updates integer loops, uses atomic.Int64, and modernizes goroutine WaitGroup handling. |
| workflow/inproc/binding_test.go | Uses slices.Contains for containment assertion. |
| workflow/executor.go | Replaces manual map copy with maps.Copy for state snapshot/restore. |
| workflow/builder_test.go | Uses slices.Contains for trace assertion. |
| workflow/agentworkflow/hosting_test.go | Modernizes loop style. |
| workflow/agentworkflow/groupchat.go | Uses strings.CutPrefix to simplify prefix handling. |
| provider/otelprovider/otel_test.go | Modernizes fixed-count loops with integer range. |
| provider/copilotprovider/copilot.go | Modernizes pointer helpers and adopts newer stdlib helpers (e.g., maps). |
| provider/copilotprovider/copilot_test.go | Updates tests to use newer pointer helpers and related config setup. |
| provider/copilotprovider/copilot_internal_test.go | Updates tests to use newer pointer helpers for SDK fields. |
| provider/aguiprovider/hosting_test.go | Uses strings.SplitSeq for streaming iteration over lines. |
| provider/a2aprovider/a2a_test.go | Modernizes fixed-count loop with integer range. |
| internal/jsonx/jsonx_test.go | Uses reflect.TypeFor[T]() instead of reflect.TypeOf. |
| internal/hashmap/hashmap_test.go | Uses maps.Collect to build a map from an iterator. |
| internal/concurrent/map_test.go | Uses maps.Collect to build a map from an iterator. |
| internal/azaiprojects/toolbox_name_test.go | Removes now-unnecessary loop-variable rebinding in parallel subtests. |
| examples/03-workflows/shared-states/main.go | Uses strings.SplitSeq to avoid allocating full split slices. |
| examples/03-workflows/concurrent/map_reduce/main.go | Uses strings.SplitSeq for split iteration in reducers/preprocessing. |
| examples/02-agents/a2a/as_function_tools/main.go | Removes now-unnecessary loop-variable rebinding. |
| cmd/verifyexamples/orchestrator.go | Uses newer WaitGroup helper for running example verification goroutines. |
| cmd/verifyexamples/example_sets.go | Removes now-unnecessary loop-variable rebinding when taking addresses. |
| cmd/prfromissue/parse.go | Uses strings.Cut for simpler substring extraction. |
| agent/skills/fsskills/source_script_test.go | Uses slices.Contains for containment check. |
| agent/middleware.go | Uses slices.Backward to iterate middlewares in reverse order. |
| agent/history_test.go | Modernizes loop style while preserving indexed goroutine pattern. |
| agent/harness/todo/todo_test.go | Modernizes fixed-count loop with integer range. |
| agent/harness/agentmode/agentmode_test.go | Modernizes fixed-count loop with integer range. |
| agent/compaction/toolresult.go | Replaces manual clamp with max() usage. |
| agent/compaction/index.go | Uses slices.Backward for reverse traversal and reverse search. |
| agent/compaction/contextwindow_test.go | Modernizes loops with integer range. |
| agent/compaction/compaction_test.go | Modernizes loops with integer range. |
| agent/agent_test.go | Modernizes fixed-count loop with integer range. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 36/36 changed files
- Comments generated: 2
- Review effort level: Lite
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
API Consistency ReviewScope: internal-only No cross-repo parity issues. The
|
Summary
go fixacross the repositoryTesting
go test ./...