Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

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

$
0
0

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.

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>