refactor: simplify literals with Go 1.27 promoted fields by dgageot · Pull Request #4324 · docker/docker-agent · GitHub
Skip to content

refactor: simplify literals with Go 1.27 promoted fields - #4324

Merged
dgageot merged 3 commits into
mainfrom
refactor/go127-promoted-fields
Sep 16, 2026
Merged

dgageot merged 3 commits into
mainfrom
refactor/go127-promoted-fields

Conversation

@dgageot

@dgageot dgageot commented Sep 16, 2026

Copy link
Copy Markdown
Member

Go 1.27 allows promoted fields in composite literals, meaning that when a struct type embeds another, the embedding struct's fields can be set directly in the outer literal without nesting a redundant by-value wrapper. Several composite literals in the runtime and config packages were still using the old style — wrapping an embedded Config or SubSessionConfig with an explicit field name even though the fields it contains are directly promoted.

This change replaces those redundant wrapper layers with direct promoted-field assignment across five files: pkg/config/runtime_test.go, pkg/config/runtime_clone_test.go, pkg/runtime/agent_delegation.go, pkg/runtime/agent_delegation_test.go, and pkg/runtime/skill_runner.go. All expressions, evaluation order, nil and zero values are preserved exactly. No frozen versioned config packages (pkg/config/v0, pkg/config/v1, …) are touched.

This is a targeted, explicit migration of the five files identified in the Go 1.27 review, not a repository-wide go fix run. Lint settings are unchanged. Two test cases (TestLoadExamples/../../examples/dmr.yaml and unload_on_switch.yaml) were skipped during the final test run because Docker Model Runner is not running locally; the identical failures reproduce on the unmodified base commit 6929d9c13, confirming they are pre-existing environment constraints unrelated to this change.

Signed-off-by: David Gageot <david.gageot@docker.com>
Signed-off-by: David Gageot <david.gageot@docker.com>
Signed-off-by: David Gageot <david.gageot@docker.com>
@dgageot
dgageot requested a review from a team as a code owner September 16, 2026 17:16
@dgageot
dgageot added this pull request to the merge queue Sep 16, 2026
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/refactor PR refactors code without behavior change labels Sep 16, 2026
Merged via the queue into main with commit 7b5eb96 Sep 16, 2026
17 checks passed
@dgageot
dgageot deleted the refactor/go127-promoted-fields branch September 16, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection kind/refactor PR refactors code without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants