Summary
The per-module unexported ptr helper exists only because the new(value) form (constructing a pointer to a non-zero value, e.g. new(false)) requires Go 1.26. The go.mod directive is currently go 1.25.9. Once the floor moves to 1.26, the helper can be deleted and call sites switched to the native form.
Location
opensearch.go:649-656
// ptr returns a pointer to a copy of value. Used for the *T query/body
// parameter pattern. Unexported by design.
//
// Once the module's go directive moves to 1.26, this helper can be deleted
// and call sites can switch to the native new(value) form: new(false).
func ptr[V any](value V) *V {
return &value
}
and also remove the anonymous function hack: func(i int) *int { return &i }(42) that is peppered throughout the project, too.
Trigger
Gated on bumping the go directive in go.mod from 1.25.9 to 1.26. Note there are per-package ptr definitions across the module (the comment refers to "the unexported ptr defined per-package") — all of them are candidates.
Acceptance criteria
Relationship to other issues
Independent of the ToPointer removal but shares the same Go 1.26 rationale — ToPointer can be removed before this; this one is blocked on the toolchain floor.
Summary
The per-module unexported
ptrhelper exists only because thenew(value)form (constructing a pointer to a non-zero value, e.g.new(false)) requires Go 1.26. Thego.moddirective is currentlygo 1.25.9. Once the floor moves to 1.26, the helper can be deleted and call sites switched to the native form.Location
opensearch.go:649-656and also remove the anonymous function hack:
func(i int) *int { return &i }(42)that is peppered throughout the project, too.Trigger
Gated on bumping the
godirective ingo.modfrom1.25.9to1.26. Note there are per-packageptrdefinitions across the module (the comment refers to "the unexportedptrdefined per-package") — all of them are candidates.Acceptance criteria
go.moddirective to1.26(precondition; may be its own PR).ptr(value)call sites withnew(value)and delete the per-packageptrhelpers.cmd/osgen) emitsnew(value)rather than aptrwrapper, if applicable.Relationship to other issues
Independent of the
ToPointerremoval but shares the same Go 1.26 rationale —ToPointercan be removed before this; this one is blocked on the toolchain floor.