LoginSignup
4
4

More than 5 years have passed since last update.

MacBookAirにGoを入れてみる

Last updated at Posted at 2014-07-10

環境

OS X 10.9.3

Download

以下の公式サイトからダウンロードだ、

現時点(2014/07/11)ではgo1.3が最新の模様。
go1.3.darwin-amd64-osx10.8.pkg
こちらをダウンロードしました。

Install

ダウンロードしたファイルを開くと以下の画面が。

install.png

では、言われるがままインストールします。

Check it

ではでは、確認。ターミナルで以下のように。

$ go version
go version go1.3 darwin/amd64

おお。大丈夫な様子だ。

Hello, Golang!!

せっかくなのでおきまりの。

ファイル作成

拡張子はgoです。hello.goを作成。
以下のように入力です。

hello.go
package main

import "fmt"

func main(){
    fmt.Printf("Hello, I'm Golang!!\n")
}

fmtは、入出力フォーマットを実装したパッケージ、だそうですよ。

いざ実行

実行コマンドと実行結果ですね、以下です。

$ go run hello.go
Hello, I'm Golang!!

Go言語さんの自己紹介が聞けたところでお開きです。

4
4
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
4
4