7 ms·
See Android Go
- Sumaso 11y agoVery exciting blog post!!! I'm looking forward to writing all my android apps in Go!!!
- tosseraccount 11y agoWhy not write it in C and slap on the native cocoa/win/gtk/android front end and have something totally "portable" to mac/ios/android/windows/linux?
- jaegerpicker 11y agoBecause go is significantly safer and more productive (of course this depends on the developer in question but on average) and using the ndk with c/c++ for serious development on android is absolutely one of the worst modern platform development experiences out there.
- cartoonfoxes 11y ago> using the ndk with c/c++ for serious development on android is absolutely one of the worst modern platform development experiences out there. I have to second this. Serious attempts to use the NDK for application-layer work will turn your hair white. It's by far the most god-awful mobile/quasi-embedded tasks I've had professionally. In my experience it's second maybe only to porting C-decompiled FORTRAN between families of obsolete and badly documented DSP chips.
- rhodysurf 11y agoHow is go not portable to all of those platforms?
- tosseraccount 11y agoNo doubt it's potentially portable. Can I compile a GO only program and run on ios?
- fit2rule 11y agoI 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/ http://ipfs.io/) as a test, and it runs quite well on iOS: https://github.com/seclorum/ios-go-ipfs/blob/master/ipfsios/ipfsios/gosources/main.go https://github.com/seclorum/ios-go-ipfs/blob/master/ipfsios/...
- tosseraccount 11y agoIs see stuff like 'cgo' and 'import "C"'. What's going on here?
- fit2rule 11y agoThis 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) https://en.wikipedia.org/wiki/Bridging_(programming) ]
- rhodysurf 11y agoYou dont need to do any of the cgo stuff manually anymore with gomobile
- Zigurd 11y agoBecause it would suck. Android is about app modularity and inter-app cooperation. It is about installable services with high and low-level APIs. It is about handling multiple screen geometries not just with conditional layouts, but also with code reusability in Fragment objects. Skin-deep UI "portability" results in a lowest-common-denominator experience.
- rhodysurf 11y agoWhy does nay of that restrict writing business logic in c or go, then just interfacing it in the Fragment or whatever?
- Zigurd 11y agoIt doesn't. But that's not what the parent comment was suggesting. If you have anything compute-intensive enough to affect battery life in an Android app, you really ought to use the NDK, and Go will probably be officially supported: https://docs.google.com/document/d/1N3XyVkAP8nmWjASz8L_OjjnjVKxgeVBjIsTr5qIUcA4/edit https://docs.google.com/document/d/1N3XyVkAP8nmWjASz8L_Ojjnj... Or if you want Android/iOS portability, find a common API for SQLite and implement in C.
- V-2 11y agoThe question is, why would I want that? With the availability of Kotlin, Groovy or (somewhat limited I believe, but still) Scala on Android, what advantages does Go offer? I was under impression that it's more of a backend language, tailored to the needs of backend devs I understand the crossplatform argument - write a platform-agnostic library in Go, and use it in your iOS and Android app etc. but it doesn't answer "why Go, of all languages". It's an honest question, not a flamebait. Is there anything specific about Go that makes it well suited for mobile environment, or is it like a using a great shiny truck to deliver pizza "because you can" : )
- tosseraccount 11y agoApple is (was?) very tight about what they allow on ios. Do they allow go programs on iphone and ipad? Serious question, people. [ are the downvotes because I mentioned apple is very controlling? ]
- akhilcacharya 11y agoYes, Ivy recently passed review. UI code is native, business logic is Go. https://itunes.apple.com/us/app/ivy-big-number-calculator/id1012116478?mt=8 https://itunes.apple.com/us/app/ivy-big-number-calculator/id...
- Zypho 11y agoThis is what I want to see more of, I get very worried about any tech claiming to overtake the UI layer of your application and make it cross platform. It never makes sense to do IMO. Logic and models though however, I can't wait!
- threeseed 11y agoCouldn't agree more on this. And hopefully there are a enough examples now to show why it simply doesn't work. If you can't be bothered to fully embrace the design approach of the host platform e.g. Material Design then don't expect your users to be bothered to download your apps. Because most people appreciate that their apps look and feel like a true native app and not some cross platform version that was designed to put the developers first and the users second.
- rhodysurf 11y agoI have been playing with the gomobile "bind" command to generate cross platform libraries for my Android and iOS app. Its quite easy to use, but the GC has been a pain in the ass on iOS. Its hard to track what the Go GC is doing and I am fighting with a bunch of EXC_BAD_ACCESS errors when calling operations on Go data structures. Still its a pretty fun experiment to have one backend for all the different native front ends.
- therealmarv 11y agoWould like to see some apps which use go as business logic. Nevertheless there is not just iOS and Android. It would be great to have also JS covered. Does somebody know if there is a go -> emscripten/asm.js toolchain/example available?
- sajal83 11y agoWaiting for them to release the source for Ivy. I made PoC android app writing UI in Java... but curious to know how to do it purely in Go without knowing how to interact with OpenGL.