aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/out.go
diff options
context:
space:
mode:
authorAlexandre Daubois <alex.daubois@gmail.com>2025-11-24 08:14:18 +0000
committerGopher Robot <gobot@golang.org>2025-11-24 11:58:55 -0800
commita593ca9d657efb1ea021c9fc51cb528c398bbf4e (patch)
treeb3625254161b0607c0fa9fdfaeee681a52d70361 /src/cmd/cgo/out.go
parent89552911b383b78cd8807ec747ca5df8ba52e239 (diff)
downloadgo-a593ca9d657efb1ea021c9fc51cb528c398bbf4e.tar.xz
runtime/cgo: add support for `any` param and return type
When using `any` as param or return type of an exported function, we currently have the error `unrecognized Go type any`. `any` is an alias of `interface{}` which is already supported. This would avoid such change: https://github.com/php/frankenphp/pull/1976 Fixes #76340 Change-Id: I301838ff72e99ae78b035a8eff2405f6a145ed1a GitHub-Last-Rev: 7dfbccfa582bbc6e79ed29677391b9ae81a9b5bd GitHub-Pull-Request: golang/go#76325 Reviewed-on: https://go-review.googlesource.com/c/go/+/720960 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/cgo/out.go')
-rw-r--r--src/cmd/cgo/out.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
index 00c9e8c9a3..dc1e5b29e5 100644
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -1558,6 +1558,9 @@ func (p *Package) doCgoType(e ast.Expr, m map[ast.Expr]bool) *Type {
if t.Name == "error" {
return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")}
}
+ if t.Name == "any" {
+ return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")}
+ }
if r, ok := goTypes[t.Name]; ok {
return goTypesFixup(r)
}