1.download source : http://golang.org/doc/Installed , here i haved file named 'go1.1.linux-386.tar.gz' , decompress it.
2.To build the Go distribution, run
$ cd go/src
$ ./all.bash
(To build under Windows use all.bat.)
If all goes well, it will finish by printing output like:
ALL TESTS PASSED
---
Installed Go for linux/amd64 in /home/you/go.
Installed commands in /home/you/go/bin.
*** You need to add /home/you/go/bin to your $PATH. ***
3.here, so you could add the following commands:
export GOROOT=$HOME/install_soft/go/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN
4.craete a file name hello.go :
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
Then run it with the go tool:
$ go run hello.go
hello, world
有疑问加站长微信联系(非本文作者)