Skip to content

refactor: adopt go 1.27 idioms - #4935

Merged
amir20 merged 2 commits into
masterfrom
go-1.27-idioms
Aug 20, 2026
Merged

refactor: adopt go 1.27 idioms#4935
amir20 merged 2 commits into
masterfrom
go-1.27-idioms

Conversation

@amir20

@amir20 amir20 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Follow-up to #4934 now that the toolchain is on go 1.27.

  • errors.AsType instead of declaring a target var and calling errors.As
  • promoted fields set directly in composite literals, now that 1.27 allows it (docker HostConfig resources, network.Summary, k8s TypeMeta/ObjectMeta, embedded test fixtures)
  • strings.Cut instead of strings.Split when splitting env vars on =
  • separate commit for go mod tidy, which had drifted on master

go build, go vet and go test ./internal/... all pass on 1.27.0.

amir20 and others added 2 commits August 20, 2026 10:02
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- errors.AsType instead of a declared target var with errors.As
- promoted fields set directly in composite literals (docker HostConfig,
  network.Summary, k8s TypeMeta/ObjectMeta, embedded test fixtures)
- strings.Cut instead of strings.Split for env var name parsing

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@claude

claude Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewed. Clean, mechanical refactor, no functional changes.

  • errors.AsType[*json.UnmarshalTypeError](err) in event_generator.go:320 correctly replaces the declare+errors.As pattern, single usage so errors import still needed.
  • Promoted-field literals (deployer.go HostConfig, manager_test.go network.Summary, k8s client_test.go TypeMeta/ObjectMeta) all target genuinely embedded structs, gofmt alignment looks correct.
  • strings.Cut(env, "=") in valid_env.go:26 is equivalent to the old strings.Split(env, "=")[0].
  • Couldn't execute go build/go vet in this sandbox to double check errors.AsType compiles against your 1.27 toolchain, but PR description says it was verified locally.

No bugs, security, or test coverage concerns. LGTM.

@amir20
amir20 merged commit 017690d into master Aug 20, 2026
10 of 11 checks passed
@amir20
amir20 deleted the go-1.27-idioms branch August 20, 2026 19:17
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