[2014/09/03追記]
- こういう
GOPATH
の管理の方が良いのかしら?
まだコンニチワまでしか進んでないので、ほぼ自分用のメモです。
WebStorm を利用しているのは、単純に、馴染んでいる IDE がこれだから、です..
環境構築(Mac)
自分の環境:
OS:Mac OS X 10.9.4 (Mavericks)
HomeBrew:0.9.5
Go:結果、1.3
になりました
-
といっても、インストールは brew コマンドで一発。
$ brew install go
-
バージョンの表示
$ go version go version go1.3 darwin/amd64
-
ヘルプの表示。ふむふむ。
$ go help 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 filetype file types 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.
-
WebStorm を適当なプロジェクトで起動し、Go 用の Plugin を追加
-
環境変数
GOROOT
GOPATH
を追加.bash_profileexport GOROOT=/usr/local/opt/go/libexec export GOPATH=$HOME/.go
※
GOPATH
は外部ライブラリのインストール先で、どこでもいいらしい -
このままだと WebStorm からは環境変数を認識してくれないので、
/etc/launchd.conf(新規に作成)setenv GOROOT /usr/local/opt/go/libexec setenv GOPATH $HOME/.go
-
OSを再起動する(もしかして他に方法があるかもしれない..)。
WebStorm でプロジェクトを作成
-
新規プロジェクトの作成(Create New..)で、Type に Go Application を選択。
-
そのまま [OK] を選択。
-
基本構成の状態で、ファイルが作成されている。
pkg ディレクトリがあるのは、昔のなごり??
-
ビルドして実行ファイルを作ってみる。
終わりに
Google社が開発している Go なので、GAEと相性がいいのだろうか。とりあえず WebStorm から GAE に簡単にデプロイできそうなメニューを発見。(GAEのアカウント持ってないので、続きはまた今後..)