Go version
go version go1.24.0 darwin/arm64
Output of go env
in your module/workspace:
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE='auto'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/brien/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/brien/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/r3/v_3z60rx2cxg0s1r9tl9fbmw0000gn/T/go-build844271096=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/brien/bringyour/sdk/go.mod'
GOMODCACHE='/Users/brien/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/brien/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/brien/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
A simple non-generic type alias used to export correctly with gomobile bind
. Now the type alias is not exported.
type Foo = int
Anywhere the type alias is used will also not be exported, with a "skipped" message similar to below
// skipped field Bar.MyFoo with unsupported type: my/package.Foo
What did you see happen?
Latest 1.24 release
What did you expect to see?
Type aliases would export as they have in the past.
Comment From: gabyhelp
Related Issues
- x/mobile: function with alias type as argument or return value cannot be exported #39735
- x/mobile: gomobile bind with go1.23 no exported names in the package #69612
- x/mobile/bind: Functions with type alias parameters result in cryptic errors #13190 (closed)
- x/mobile: support for go/types.Aliases #70698
- x/mobile/bind: panic on alias to builtin type (e.g. string) #29559 (closed)
- go/types: 'under' panics on Alias type #68877 (closed)
- x/mobile: imported structs from other packages get skipped even if they're valid #39791 (closed)
- cmd/compile: can't use aliased type as underlying type in type parameter #68935 (closed)
- x/mobile: gobind type-checking fails with v2+ modules #33272 (closed)
- x/mobile: build error after upgrade go to 1.12 #30637 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: mknyszek
Is this possibly a duplicate of #70698?
Comment From: xcolwell
Is this possibly a duplicate of #70698?
Setting GODEBUG=gotypesalias=0
does appear to solve the issue.
export GODEBUG=gotypesalias=0
gomobile bind ...
Comment From: fortuna
I'm having the same issue, and @xcolwell 's workaround fixed the issue for me.
The code generation code probably needs to call Unalias
on the Alias
types, as per https://pkg.go.dev/go/types#Alias.