CentOS 5.2 で GO 言語

寝つけないので、ちまたで、話題になっている、GO 言語に参加。

ちなみに、家のサーバのハードウエアは、しょぼい。
CPU: AthlonXP 1700+
MEM: 768MB

OS は CentOS 5.2 だ。
今回は、その上で GO をインストールしてうごかしてみる。

$ sudo yum --enablerepo=rpmforge install mercurial
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
$ vi ~/.bash_profile
GOHOME=$HOME/go
GOARCH=386
GOOS=linux
GOBIN=$GOHOME/bin
PATH=$PATH;$GOBIN
export GOHOME GOARCH GOOS GOBIN PATH
(上記を追加)
$ source ~/.bash_profile
$ cd $GOROOT/src
$ ./all.bash

10分ぐらい待って、ビルド完了。
早速。

$ cat hello.go
package main
import "fmt"
func main() {
  fmt.Printf("Hello, World!\n")
}

$ 8g hello.go
$ 8l hello.8
$ ./8.out
Hello, World!

なるほど。


お作法で気になる点

  • メソッドの頭は大文字なのか。
  • インデントは1なのか?

まあ、ぼちぼちためそう。