Skip to content

fix(go): use reflect.Pointer instead of deprecated reflect.Ptr - #18440

Merged
deep-gandhii merged 5 commits into
mainfrom
fix/go-reflect-pointer
Oct 22, 2026
Merged

deep-gandhii merged 5 commits into
mainfrom
fix/go-reflect-pointer

Conversation

@deep-gandhii

@deep-gandhii deep-gandhii commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Linear ticket: N/A

The current fernapi/go-seed image (Go 1.26.4, golangci-lint v2.12.2) makes every go-sdk fixture fail its lint script, because the newer govet inline analyzer flags the deprecated reflect.Ptr alias in the generator's as-is files:

internal/explicit_fields.go:64:19: inline: Constant reflect.Ptr should be inlined (govet)

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 the linux-amd64 Go tarball). Customers linting generated SDKs with Go 1.26+ hit the same warning.

Changes Made

  • Rename reflect.Ptr → reflect.Pointer in the files copied into generated SDKs:
    • v1 embedded files: generators/go/internal/generator/sdk/internal/{environment,explicit_fields,extra_properties,http,query}.go, sdk/core/xml.go
    • v2 as-is templates: generators/go-v2/base/src/asIs/internal/{extra_properties,http,query}.go_
  • Update the generator's golden testdata (generators/go/internal/testdata) and the go-sdk/go-model seed snapshots to match (mechanical, same rename).
  • Changelog: generators/go/sdk/changes/unreleased/reflect-pointer.yml.
  • Not changed: generators/go/internal/fern/ir/ (the generator's own generated IR types; not shipped in SDKs).
  • Updated README.md generator (if applicable)

reflect.Pointer is Go 1.18+. Generated SDKs already require 1.18 (minimumGoVersion in mod_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.0 here: the current go-seed image also lacks docker compose, which #18437 restores. Moving the pin is a one-line follow-up once that image is republished.

Testing

  • Unit tests added/updated
  • Manual testing completed:
    • cd generators/go && go test ./... passes (golden testdata matches).
    • Ran the go-sdk seed lint script in fernapi/go-seed:latest (Go 1.26.4, golangci-lint v2.12.2):
      • path-parameters/no-custom-config before: 3 issues: govet: 3; after: 0 issues
      • exhaustive/no-custom-config and query-parameters after, with --max-same-issues=0 --max-issues-per-linter=0: 0 issues
    • With the pin moved in an earlier revision of this PR, CI showed no lint findings in any go-sdk fixture; the remaining failures were all docker compose missing from the image (fixed in fix(seed): fix WireMock on arm64 and restore docker compose in seed images #18437).

Generated with Claude Code

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>
@deep-gandhii deep-gandhii self-assigned this Oct 21, 2026

@nitpickybot nitpickybot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-10-22T04:06:10Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
go-sdk square 124s (n=5) 227s (n=5) 135s +11s (+8.9%)

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 fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-10-22T04:06:10Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-10-22 17:04 UTC

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>
@deep-gandhii
deep-gandhii merged commit e318317 into main Oct 22, 2026
77 checks passed
@deep-gandhii
deep-gandhii deleted the fix/go-reflect-pointer branch October 22, 2026 17:44
deep-gandhii added a commit that referenced this pull request Oct 22, 2026
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>
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.

2 participants