• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

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

Search This thread

alireza7991

Senior Member
Sep 2, 2012
772
2,318
23
Shahrekord
alirezafn.net
File:Golang.png

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:

raveur

Member
Nov 10, 2006
8
3
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?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    File:Golang.png

    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.
    2
    I 've spend +10 hours on this project for 0 people using it !
    1
    Well done man! I'm trying it now :)
    Will report results soon ;)
    1
    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.