Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP alireza7991

28th February 2014, 06:23 PM   |  #1  
alireza7991's Avatar
OP Senior Member
Flag Shahrekord
Thanks Meter: 2,273
 
769 posts
Join Date:Joined: Sep 2012
Donate to Me
More

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.
Last edited by alireza7991; 15th May 2014 at 04:30 PM.
The Following 13 Users Say Thank You to alireza7991 For This Useful Post: [ View ]
28th February 2014, 06:25 PM   |  #2  
alireza7991's Avatar
OP Senior Member
Flag Shahrekord
Thanks Meter: 2,273
 
769 posts
Join Date:Joined: Sep 2012
Donate to Me
More
reserved
The Following 2 Users Say Thank You to alireza7991 For This Useful Post: [ View ]
28th February 2014, 07:44 PM   |  #3  
DeveDroid's Avatar
Senior Member
Thanks Meter: 656
 
314 posts
Join Date:Joined: Jan 2014
More
Well done man! I'm trying it now
Will report results soon
The Following User Says Thank You to DeveDroid For This Useful Post: [ View ]
1st March 2014, 06:58 PM   |  #4  
alireza7991's Avatar
OP Senior Member
Flag Shahrekord
Thanks Meter: 2,273
 
769 posts
Join Date:Joined: Sep 2012
Donate to Me
More
I 've spend +10 hours on this project for 0 people using it !
The Following 2 Users Say Thank You to alireza7991 For This Useful Post: [ View ]
1st March 2014, 07:18 PM   |  #5  
Junior Member
Thanks Meter: 3
 
7 posts
Join Date:Joined: Nov 2006
More
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?
1st March 2014, 08:58 PM   |  #6  
alireza7991's Avatar
OP Senior Member
Flag Shahrekord
Thanks Meter: 2,273
 
769 posts
Join Date:Joined: Sep 2012
Donate to Me
More
Quote:
Originally Posted by raveur

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.
The Following User Says Thank You to alireza7991 For This Useful Post: [ View ]
2nd March 2014, 03:22 PM   |  #7  
jonathanxx1's Avatar
Senior Member
Thanks Meter: 192
 
489 posts
Join Date:Joined: Jan 2013
Great project,
Thanks for that.
2nd March 2014, 04:03 PM   |  #8  
Junior Member
Thanks Meter: 1
 
8 posts
Join Date:Joined: Aug 2009
Still no NDK support for Go?
2nd March 2014, 05:07 PM   |  #9  
alireza7991's Avatar
OP Senior Member
Flag Shahrekord
Thanks Meter: 2,273
 
769 posts
Join Date:Joined: Sep 2012
Donate to Me
More
Quote:
Originally Posted by myfreeweb

Still no NDK support for Go?

Go has no Android JNI support thus there is no Go support in NDK .

The Following User Says Thank You to alireza7991 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
android, compiler, golang, google, port
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes