LoginSignup
2
2

More than 5 years have passed since last update.

Go言語に触れてみる

Posted at

最近ちょいちょいGo言語の話を聞くし,
python以外にも触れる言語増やしていきたいからやってみる.

インストール

自分はmacだからhomebrewでインストールできるのありがたい.

> brew install go
# version確認
> go version
go version go1.3.1 darwin/amd64

.zshrcに追加

export GOPATH=$HOME/Documents/programming/go
export PATH=$PATH:$GOPATH/bin

開発環境

普段Sublime Textを使っているので,プラグインGosublimeをインストール
Ctrl+Command+p -> Package Control Install -> Gosublime
よしなに補完してくれるのありがたい,

でっも今のところpackage "fmt"が補完してもらえない理由分からない.

お決まりのHelloWorld

ソースコード

hello.go
packge main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}

ビルド,実行

> go build hello.go
> ./hello
Hello World!

結構面白そうだし,ちょっとずつ勉強してみようかな!

参考:
http://sessan.hatenablog.com/entry/2013/06/23/160916
http://d.hatena.ne.jp/hiro_nemu/20140113/1389620004

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