2
2

More than 5 years have passed since last update.

Go言語

Last updated at Posted at 2014-03-25

Install

まず、処理系はインストールからGoコンパイラとGCCコンパイラコレクションがあるが、今回はGoコンパイラをソースからインストールしてみる。

$ curl -O https://storage.googleapis.com/golang/go1.4.2.src.tar.gz # 現時点では1.4.2が最新
$ export GOROOT=$HOME/local/go # go言語をインストールする場所を決める。~/.zshenvとかに書いておく
$ tar -C $GOROOT -zxvf go1.4.2.src.tar.gz
$ cd $GOROOT/src
$ ./all.bash

ref. http://golang.jp/install/source

開発環境を整える

$ mkdir $HOME/go # パッケージやらなんやらが入るディレクトリ
$ export $GOPATH=$HOME/go # ~/.zshenvに書いておく
$ go get golang.org/x/tools/cmd/godoc # ドキュメント閲覧ツールをインストールしておく

Hello World!

hello.go
package main

import fmt "fmt"

func main() {
    fmt.Printf("Hello world\n")
}
$ go build hello.go

参照

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2