golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124k stars 17.67k forks source link

x/mobile: If there is a private method in interface, it fails to generate IOS codes. (gobind) #57682

Open taeguk opened 1 year ago

taeguk commented 1 year ago

If there is a private method in interface, it fails to generate methods whose return two results. (gobind)

Example code

type Test interface {
    A() string // OK!
    B() (string, error) // Error!

    c()
}

Error message

$ gomobile bind -target=ios -o "dist/RektEngine.xcframework" "github.com/justx-inc/rekt-engine/sdk/engine"

gomobile: iossimulator/amd64: go build -buildmode=c-archive -o /var/folders/kg/m9tfxgnj5zqgmr6pq5ttmqy00000gn/T/gomobile-work-1509676306/RektEngine-iossimulator-amd64.a ./gobind failed: exit status 2
# gobind/gobind
Engine_darwin.m:1883:35: error: incomplete result type 'struct cproxyengine_Test_B_return' in function definition
Engine_darwin.m:1883:8: note: forward declaration of 'struct cproxyengine_Test_B_return'
Engine_darwin.m:1901:3: error: must use 'struct' tag to refer to type 'cproxyengine_Test_B_return'
Engine_darwin.m:1901:30: error: variable has incomplete type 'struct cproxyengine_Test_B_return'
Engine_darwin.m:1883:8: note: forward declaration of 'struct cproxyengine_Test_B_return'
cherrymui commented 1 year ago

cc @hyangah @golang/ios @golang/android