|
|
Install Google's GO language in Ubuntu LinuxFrom ezUnix
IntroductionGo is a new programming language created by Google aiming to be fast, safe, concurrent, fun to code in and open source. Read the Go docs to learn more about the language: http://golang.org/doc/install.html
Install dependencies.Install gcc package if you do not have build-essential. # sudo apt-get install bison build-essential libc6-dev ed mercurial
Environment variablesSet environment variables: # export GOROOT=$HOME/go # export GOOS="linux" # echo $(uname -m)| grep -q 86_64 && export GOARCH="amd64" || export GOARCH="386" Check the variables # env | grep '^GO' The GOARCH variable should be either "amd64" or "386". Just add the lines with export to your .bashrc to make them permanent.
Get the source files of GoDownload the source code for Go. It is saved to $HOME/go/. # hg clone -r release https://go.googlecode.com/hg/ $GOROOT
Compile GoNow you can compile it: #cd $GOROOT/src # ./all.bash Notice: Compilation process may report some bugs.
Test GoCreate a $HOME/test/ folder and move there. # mkdir $HOME/test # cd $HOME/test
# vi hello.go Add the following go'code to it package main
import "fmt"
func main() {
fmt.Printf("Hello all. Let's GO!\n")
}
Read: http://golang.org/doc/install.html#tmp_71 (at the bottom) If you have 32-bit Linux, use 8g and 8l to compile and link the code. For 64-bit use 6g and 6l. # 6g hello.go # 6l hello.6 And finally run it (./6.out or ./8.out) # ./6.out
Hello all. Let's GO!
That's all folks!
Suffrage said ...
18:40, 16 May 2010 (CEST)
http://golanguage.ru/install - здесь сможете найти русскую инструкцию по установке =)
|