Interpreting Go as Python, Ruby, Bash

    #!/usr/bin/gorun
    package main
    func main() {
        println("Hello world!")
    }
    

    Then:
    $ chmod +x hello.go
    $ ./hello.go
    Hello world!
    
    That's all.

    How to put gorun ?


    For those who already have go installed from the mercurial repository:
    $ goinstall launchpad.net/gorun


    Or for Ubuntu 10.04 LTS and higher (arm, i386, amd64) you can install Go in one package. gorun will already be enabled:
    $ sudo add-apt-repository ppa:gophers/go
    $ sudo apt-get update
    $ sudo apt-get install golang-stable # Или golang-weekly, или golang-tip
    


    A small example


    $ time ./gorun hello.go
    Hello world!
    ./gorun hello.go  0.03s user 0.00s system 74% cpu 0.040 total
    $ time ./gorun hello.go
    Hello world!
    ./gorun hello.go  0.00s user 0.00s system 0% cpu 0.003 total
    

    From the time test it is clear that Go uses CPU time only at the first start.

    Please consider Go as another tool and no need to breed holivar in the comments.
    Thanks for attention.

    A little more information can be found here:
    https://wiki.ubuntu.com/Go
    https://wiki.ubuntu.com/gorun

    PS It would be nice to have a separate blog.

    Also popular now: