Applied via `go fix -waitgroupgo`: replaces the
wg.Add(1)/go func(){defer wg.Done()...}()
pattern in cmd/exec_jsonv2_test.go with
wg.Go(...)
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
A follow-up `go fix -inline` pass (run separately since the inline
analyzer can't see a `//go:fix inline` directive added in the same
invocation that wrote it) inlines the remaining toAnyPtr call sites
in cmd/exec_jsonv2_test.go, leaving it unused. bundle_test.go's
pointTo helper was already fully inlined by the earlier newexpr pass.
Remove both now-dead helpers.
v1/plugins/bundle/plugin_test.go's generic pointTo helper is left in
place: its remaining call sites can't be auto-inlined yet because Go's
inliner does not support type parameter inference for generic calls.
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Go 1.26 lets `new` take an expression operand, so one-off pointer
helpers are no longer needed. Applied via `go fix -newexpr -inline`,
which also drops the now-unused google.golang.org/protobuf/proto
import from v1/ir/proto.go.
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Makes OPA build and pass its tests on Go 1.27, while keeping Go 1.25 and
1.26 working. JSON output is unchanged on every supported version.
Go 1.27 json package honours `encoding.TextAppender`. Many v1 ast types
implement AppendText to build their Rego string cheaply, so on 1.27 they
would have marshalled as Rego text. Files built only with 1.27 now
implement MarshalJSONTo.
Library users should keep using `json.Marshal` etc. The MarshalJSONTo
methods are implementation details, are absent from 1.25 and 1.26
builds, and may change.
---------
Signed-off-by: Anders Eknert <anders.eknert@apple.com>
Signed-off-by: Charlie Egan <charlie_egan@apple.com>
Co-authored-by: Charlie Egan <charlie_egan@apple.com>