memo.xight.org

日々のメモ

The Go Programming Language (Go言語) - Googleによるプログラミング言語

Summary

Googleによるオープンソースのプログラミング言語。
BSDライセンスにより公開。

インストールの手順 (Installing Go)

http://golang.org/doc/install.html を参照

  1. 環境変数の設定
export GOROOT=$HOME/go
export GOARCH=386
export GOOS=linux
export GOBIN=$GOROOT/bin


  2. mercurial のインストールと実行

# aptitude install mercurial
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
requesting all changes
adding changesets
adding manifests
adding file changes
added 4109 changesets with 17125 changes to 2968 files
updating working directory
1676 files updated, 0 files merged, 0 files removed, 0 files unresolved

  3. ビルド環境の整備

$ sudo aptitude install bison gcc libc6-dev ed make

  4. ビルド

$ cd $GOROOT/src
$ ./all.bash
...
--- cd ../test
1 known bugs; 0 unexpected bugs

Makefileのサンプル

$GOROOT/src/cmd/godoc/Makefile

include $(GOROOT)/src/Make.$(GOARCH)

TARG=godoc
GOFILES=\
	godoc.go\
	index.go\
	main.go\
	snippet.go\
	spec.go\

include $(GOROOT)/src/Make.cmd

vimでシンタックスハイライト

$GOROOT/misc/vim/go.vim を利用する。

$ ln -s "$GOROOT/misc/vim/go.vim" ~/.vim/syntax/go.vim

$HOME/.vim/filetype.vim

au BufRead,BufNewFile *.go setf go


Reference

The Go Programming Language
http://golang.org/

早速 Go 言語を試してみる! - IT戦記
http://d.hatena.ne.jp/amachang/20091111/1257928890

Go言語を試す - y-kawazの日記
http://d.hatena.ne.jp/y-kawaz/20091111/1257961854

via

Google、新たなプログラミング言語「Go」をオープンソースで公開 -INTERNET Watch
http://internet.watch.impress.co.jp/docs/news/20091111_328193.html

グーグル、C / C++に代わる新言語「Go」をOSSで公開 - @IT
http://www.atmarkit.co.jp/news/200911/11/go.html