goを試す
ふかやつが来年学ぶべき言語は『Go』です。 http://t.co/pFf1wzHZ5r
— ふかやつ (@fukayatsu) January 1, 2014
はい
- The Go Programming Language
- Downloads: go1.2.darwin-amd64-osx10.8.pkg をインストール
- 顔がうざい
% go version go version go1.2 darwin/amd64 % go -h Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependencies clean remove object files env print Go environment information fix run go tool fix on packages fmt run gofmt on package sources get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packages Use "go help [command]" for more information about a command. Additional help topics: c calling between Go and C gopath GOPATH environment variable importpath import path syntax packages description of package lists testflag description of testing flags testfunc description of testing functions Use "go help [topic]" for more information about that topic.
サンプルコード(一応写経)
// hello.go package main import "fmt" func main() { fmt.Println("Hello, 世界") }
実行してみる
% go run hello.go Hello, 世界
ビルドして実行してみる
% go build hello.go % chmod +x hello % ./hello Hello, 世界
おー
TODO
- 基本の制御構文を学ぶ
- 何か作りたいものをgoで作る