Repository navigation
fix(go): use reflect.Pointer instead of deprecated reflect.Ptr - #18440
Conversation
Go 1.26's govet `inline` analyzer (golangci-lint v2.12) flags the
deprecated `reflect.Ptr` alias in the Go generator's as-is files
("Constant reflect.Ptr should be inlined"), so every go-sdk fixture fails
its lint script on the current fernapi/go-seed image. Rename it to
`reflect.Pointer` (Go 1.18+, which generated SDKs already require) in the
v1 embedded files and v2 as-is templates, and update the generator
testdata and seed snapshots to match.
With that, move go-sdk and go-model off the March fernapi/go-seed:2.0.0
pin, whose arm64 image installs the linux-amd64 Go tarball, to the current
fernapi/go-seed image like the other seed generators.
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Mechanical rename of the deprecated reflect.Ptr alias to reflect.Pointer across the Go generator's embedded/as-is files, the generator golden testdata, and the go-sdk/go-model seed snapshots, plus unpinning the fernapi/go-seed image and adding a changelog entry. The change is semantically a no-op (reflect.Ptr is an alias for reflect.Pointer, available since Go 1.18, which the generated SDKs already require), and the switch statements keep exhaustive case coverage. No issues found in the portion of the diff available for review.
Review Scope
- Mode: Full pull request
- Range:
Full pull request through 1e8f92b55b300609c2cb4d1cd4b6859f191708ce - Current range coverage: Incomplete
- Cumulative pull request coverage: Incomplete
- Limitations: diff size limit
- Cumulative limitations: diff size limit
Review finished for the available portion of this range. Coverage is incomplete, so unreviewed changes may remain.
Resolve modify/delete conflicts in seed/go-sdk/idempotency-headers/ auto-generate-idempotency-key/internal/* by keeping main's deletion. Co-Authored-By: Claude <noreply@anthropic.com>
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
The current fernapi/go-seed image has no docker compose plugin, so go-sdk wire-test scripts fail on it. #18437 restores compose (and fixes WireMock on arm64); move the pin after that image is published. This PR keeps just the reflect.Pointer fix, which also passes on 2.0.0. Co-Authored-By: Claude <noreply@anthropic.com>
Apply the reflect.Ptr -> reflect.Pointer rename to go-sdk seed snapshots that landed on main since (error-responses-shared, go-xml-twiml). Co-Authored-By: Claude <noreply@anthropic.com>
Move off fernapi/go-seed:2.0.0 (March), whose arm64 image installs the linux-amd64 Go tarball, to fernapi/go-seed:fdc792df0, built from #18437 (arm64 WireMock, docker compose kept). #18440 already fixed the reflect.Ptr lint findings the newer golangci-lint reports. Uses the immutable build tag rather than `latest` so seed runs stay reproducible. Co-authored-by: Claude <noreply@anthropic.com>
Description
Linear ticket: N/A
The current
fernapi/go-seedimage (Go 1.26.4, golangci-lint v2.12.2) makes every go-sdk fixture fail its lint script, because the newer govetinlineanalyzer flags the deprecatedreflect.Ptralias in the generator's as-is files:go-sdk still pins the March
go-seed:2.0.0, so CI doesn't see it yet, but it blocks moving off that pin (its arm64 image installs thelinux-amd64Go tarball). Customers linting generated SDKs with Go 1.26+ hit the same warning.Changes Made
reflect.Ptr→reflect.Pointerin the files copied into generated SDKs:generators/go/internal/generator/sdk/internal/{environment,explicit_fields,extra_properties,http,query}.go,sdk/core/xml.gogenerators/go-v2/base/src/asIs/internal/{extra_properties,http,query}.go_generators/go/internal/testdata) and the go-sdk/go-model seed snapshots to match (mechanical, same rename).generators/go/sdk/changes/unreleased/reflect-pointer.yml.generators/go/internal/fern/ir/(the generator's own generated IR types; not shipped in SDKs).reflect.Pointeris Go 1.18+. Generated SDKs already require 1.18 (minimumGoVersioninmod_file.go, and the as-is files use generics), so this doesn't raise the floor. go-model embeds the same files, so its output changes the same way; I only added an SDK changelog entry since go-model is disabled in seed. Happy to add a model entry if you want one.The seed pin stays at
go-seed:2.0.0here: the current go-seed image also lacksdocker compose, which #18437 restores. Moving the pin is a one-line follow-up once that image is republished.Testing
cd generators/go && go test ./...passes (golden testdata matches).fernapi/go-seed:latest(Go 1.26.4, golangci-lint v2.12.2):path-parameters/no-custom-configbefore:3 issues: govet: 3; after:0 issuesexhaustive/no-custom-configandquery-parametersafter, with--max-same-issues=0 --max-issues-per-linter=0:0 issuesdocker composemissing from the image (fixed in fix(seed): fix WireMock on arm64 and restore docker compose in seed images #18437).Generated with Claude Code