📜 ⬆️ ⬇️

We interpret 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 an installed go from the mercurial repository:
 $ goinstall launchpad.net/gorun 


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

')

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 the first time it is started.

Please consider Go, as another tool and do not 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 start a separate blog.

Source: https://habr.com/ru/post/137730/


All Articles