[Notice] Cloudflare provider //go:linkname to unexported API method under Go 1.23+ toolchains
Author: H-XX-DCreated Sep 19, 2026Updated Sep 19, 2026
Summary
In pkg/project/provider/cloudflare.go, line 136 uses //go:linkname to invoke an unexported private method in the third-party cloudflare-go package:
//go:linkname makeRequestContext github.com/cloudflare/cloudflare-go.(*API).makeRequestContext
func makeRequestContext(*cloudflare.API, context.Context, string, string, interface{}) ([]byte, error)Context & Toolchain Invariant
Starting in Go 1.23 (and Go 1.24, which sst/go.mod specifies: go 1.24.7), the Go compiler and linker introduced strict linkname checking (-checklinkname) that restricts //go:linkname directives targeting unexported functions in external third-party packages.
While this allows SST to currently bypass package visibility and access Cloudflare's internal HTTP dispatcher, it introduces two stability risks:
- Toolchain / Linker Breakage: Go toolchain iterations or standard builds outside specific ldflags can reject external unexported linknames.
- Upstream Drift: Any refactor or symbol rename of
(*API).makeRequestContextin upstreamcloudflare-gowill result in an unresolved symbol error at link time rather than compile time.
Recommendation
Consider either:
- Wrapping Cloudflare's public
CustomClient/BaseURLtransport to execute custom HTTP requests cleanly through the exported SDK surface. - Documenting or formalizing explicit build flags if
-checklinkname=0is required for contributor environments.
Source: anomalyco/sst