I did it, its trivial. The magic sauce is all in the use of the #cgo directive, which gives you a way of exporting Go to iOS code and vice versa. I ported IPFS (http://ipfs.io/) as a test, and it runs quite well on iOS:
This is the glue that the Go compiler needs to export its symbols in a way that they can be used from the C side of things in Objective-C, and vice versa. Think of it like a toll-free bridge [ * ] between the ObjC and Golang runtimes.
Comments
I did it, its trivial. The magic sauce is all in the use of the #cgo directive, which gives you a way of exporting Go to iOS code and vice versa. I ported IPFS (http://ipfs.io/) as a test, and it runs quite well on iOS:
https://github.com/seclorum/ios-go-ipfs/blob/master/ipfsios/...
Is see stuff like 'cgo' and 'import "C"'.
What's going on here?
This is the glue that the Go compiler needs to export its symbols in a way that they can be used from the C side of things in Objective-C, and vice versa. Think of it like a toll-free bridge [ * ] between the ObjC and Golang runtimes.
[ * - See https://en.wikipedia.org/wiki/Bridging_(programming) ]
You dont need to do any of the cgo stuff manually anymore with gomobile