Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,728,571 Members 55,026 Now Online
XDA Developers Android and Mobile Development Forum

[PROJECT][PORT] Go4Droid v1 | write,run,compile Go Lanuage codes on your phone !

Tip us?
 
alireza7991
Old
(Last edited by alireza7991; 15th May 2014 at 03:30 PM.)
#1  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2203
Posts: 743
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
Default [PROJECT][PORT] Go4Droid v1 | write,run,compile Go Lanuage codes on your phone !


about Go Language

Go, also called golang, is a programming language initially developed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson.It is a statically-typed language with syntax loosely derived from that of C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library. Beyond that broad category, Go is defined by:

-A syntax and environment adopting patterns more common in dynamic languages:
Concise variable declaration and initialization through type inference (x*:= 0 not int x = 0;).
-Fast compilation times.
-Remote package management (go get).and online package documentation
-Distinctive approaches to particular problems.
-Built-in concurrency primitives: light-weight processes (goroutines), channels, and the select statement.
-An interface system in place of virtual inheritance, and type embedding instead of non-virtual inheritance.
-A toolchain that, by default, produces statically linked native binaries without external dependencies.
-A desire to keep the language specification simple enough to hold in a programmer's head,in part by omitting features common to similar languages:

no type inheritance
no method or operator overloading
no circular dependencies among packages
no pointer arithmetic
no assertions
no generic programming

about Go4Droid

Although Go is a Google project ,it has not option for building for Android !Also It has there is no way to use it on your Android device and do compiling(instead of cross-compiling) (beacuase it does not building for external host and target).All this reasons made me think about this project and finally I ported a complete set of Go compiler, Go linker, Go Packages and also net support !.
You can easily write go codes , compile them, run them and install them. There are lots of packages which let you write amazing programs.

prequisites

minimum :

- Root privilege
- ARMv7 (vfpv3) SoC.
- Android +1.6 (linux kernel +2.6)
- 80 MB free space in system partition
- CWM/TWRP installed

suggested :

- Root privilege
- ARMv7 (vfpv3) + NEON SoC.
- Android +4.2 (linux kernel +3.4)
-150 MB free space in system partition
- CWM/TWRP installed

installation

- Download zip file.
- Install CWM/TWRP.
- Ready !

usage

This thread is not supposed to be a GoLang tutorial , however I explain main options.

* Do not forget to get root before anything :

Code:
su
1- Use this command to run a .go file (file = helloworld.go):

Code:
go run helloworld.go
2- Use this command to compile a .go file and generate an executable :

Code:
go build helloworld.go
./helloworld
3- Use this command to compile & install a code file:

Code:
go install helloworld.go
helloworld
example

Code:
package main
 
import "fmt"
 
func main() {
    fmt.Println("Hello, World")
}
download

Go4Droid v1

*intial release

help the project

Every single build takes +30 minutes on my Android device so it would be difficult to manage this project. You can help me by donating me a VPS/Dedicated server then I will be able to update and manage this project faster and better.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following 12 Users Say Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
alireza7991
Old
#2  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2203
Posts: 743
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
reserved
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following 2 Users Say Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
DeveDroid
Old
#3  
DeveDroid's Avatar
Senior Member
Thanks Meter 622
Posts: 318
Join Date: Jan 2014
Well done man! I'm trying it now
Will report results soon
DeveDroid



MY WORKS
 

Tweakdrypt Mod
[For all devices]
GalaxyWave UltraKat Rom
[For Samsung Wave 1 & 2]
HonamiWave UltraKat Rom
[For Samsung Wave 1 & 2]
Slimify Rom/Mod
[For Samsung Wave 1 & 2]
And many more!
The Following User Says Thank You to DeveDroid For This Useful Post: [ Click to Expand ]
 
alireza7991
Old
#4  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2203
Posts: 743
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
I 've spend +10 hours on this project for 0 people using it !
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following 2 Users Say Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
raveur
Old
#5  
Junior Member
Thanks Meter 3
Posts: 6
Join Date: Nov 2006
That's great, man. You beat Google to it!

This looks interesting, but without access to the UI or Android APIs, we're pretty limited, right?
 
alireza7991
Old
#6  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2203
Posts: 743
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
Quote:
Originally Posted by raveur View Post
That's great, man. You beat Google to it!

This looks interesting, but without access to the UI or Android APIs, we're pretty limited, right?
There is no Android JNI support yet (and unfortunately no plan to do it). However it has a great builtin API with net,archive,fs,os,image,... support.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan
The Following User Says Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
 
jonathanxx1
Old
#7  
Senior Member
Thanks Meter 49
Posts: 369
Join Date: Jan 2013
Great project,
Thanks for that.
 
myfreeweb
Old
#8  
Junior Member
Thanks Meter 1
Posts: 8
Join Date: Aug 2009
Still no NDK support for Go?
 
alireza7991
Old
#9  
alireza7991's Avatar
Senior Member - OP
Thanks Meter 2203
Posts: 743
Join Date: Sep 2012
Location: Shahrekord

 
DONATE TO ME
Quote:
Originally Posted by myfreeweb View Post
Still no NDK support for Go?
Go has no Android JNI support thus there is no Go support in NDK .
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Brian Kernighan

The Following User Says Thank You to alireza7991 For This Useful Post: [ Click to Expand ]
Tags
android, compiler, golang, google, port
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes