developer's diary

最近はc#のエントリが多いです

amazonLinuxでgo言語を動かすまで。

Getting Started - The Go Programming Languageの内容をもとに、awsで実験君のメモ。


32bitの場合

[ec2-user@ip-10-146-21-163 ~]$ sudo su -
[root@ip-10-146-21-163 ~]# yum install mercurial bison gcc make
[root@ip-10-146-21-163 ~]# hg clone -u release https://go.googlecode.com/hg/ go
[root@ip-10-146-21-163 ~]# cd go/src
[root@ip-10-146-21-163 ~]# ./all.bash
[root@ip-10-146-21-163 ~]# PATH=$PATH:/root/go/bin
[root@ip-10-146-21-163 ~]# export PATH
[root@ip-10-146-21-163 ~]# cat >hello.go <<EOF
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}
EOF
[root@ip-10-146-21-163 ~]# 8g hello.go
[root@ip-10-146-21-163 ~]# 8l hello.8
[root@ip-10-146-21-163 ~]# ./8.out
hello, world
[root@ip-10-146-21-163 ~]#


64bitの場合

[ec2-user@ip-10-156-13-173 ~]$ sudo su -
[root@ip-10-156-13-173 ~]# yum install mercurial bison gcc make
[root@ip-10-156-13-173 ~]# hg clone -u release https://go.googlecode.com/hg/ go
[root@ip-10-156-13-173 ~]# cd go/src
[root@ip-10-156-13-173 ~]# ./all.bash
[root@ip-10-156-13-173 ~]# PATH=$PATH:/root/go/bin
[root@ip-10-156-13-173 ~]# export PATH
[root@ip-10-156-13-173 ~]# cat >hello.go <<EOF
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}
EOF
[root@ip-10-156-13-173 ~]# 6g hello.go
[root@ip-10-156-13-173 ~]# 6l hello.6
[root@ip-10-156-13-173 ~]# ./6.out
hello, world
[root@ip-10-156-13-173 ~]#

64bitと32bitの違いはコンパイルコマンドの違いみたい。
32bitは8gとか8l
64bitは6gとか6l
ちなみにgoは64bitのほうがよいみたい。