Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
これは14日のAdvent Calendarです、、、遅れてしまい申し訳ないです。
遅れてしまいましたが手が進んでいなかった編集途中のものと違うテーマで書いてみたのでもしよろしければみてもらえればうれしいです。
追記:http://anond.hatelabo.jp/touch/20141222154433
にて、ほぼコピペじゃないかとのとの指摘を貰ったので、僕なりにがんばって改変してみましたが、もしかしたらまだまだ指摘すべき点は多いかもしれません、申し訳ないです。
なおこの記事はhttp://www.moongift.jp/2014/05/gobrew-%E8%A4%87%E6%95%B0%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%81%AEgo%E3%82%82%E7%B0%A1%E5%8D%98%E3%81%AB%E7%AE%A1%E7%90%86%E3%80%81%E5%88%87%E3%82%8A%E6%9B%BF%E3%81%88/
の引用で、元記事で書かれているより詳しく解説したつもりです。
gobrewとは
みなさんgoのバージョン管理について話していきます。最近1.4のリリースが行われたgolang、ライブラリなどを開発する際に他のバージョンでもきちんと動くか確認するのは重要なことだと思われます、今回はそんなバージョン管理を簡単にするgobrewを紹介します
実際に使ってみる
インストールは
$wget--no-check-certificate https://raw.github.com/grobins2/gobrew/master/tools/install.sh-O - | shか
$curl-L https://raw.github.com/grobins2/gobrew/master/tools/install.sh | shを叩くことで可能になります。
インストールがおわったら
exportPATH="$HOME/.gobrew/bin:$PATH"eval"$(gobrew init -)"と.zshrcなどに追記してpathを通して上げてください。
では実際に使ってみましょう!
pathを通したらgobrew --helpでヘルプを起動してみましょう!
% gobrew--helpversion 0.0.2Usage: gobrew <command>[<args>]Some useful gobrew commands are:installInstall a version of go. example: gobrewinstall1.1.2 uninstall Uninstall a version of Go. use Specify which go version to use. list List available versions of go. example: gobrew list version Show the current Go versioninuse. versions Display all versions of Go installed. rehash Rehash gobrew shims(run this after installing executables) workspace Run'gobrew workspace set' from your workspace folder tosetas$GOPATH.See`gobrewhelp <command>' for information on a specific command.For full documentation, see: https://github.com/grobins2/gobrew#readmeこれでgobrewが使用可能になりました。
今回は gobrew install 1.4 と叩いて1.4を入れてみようと思います。
そしたら
gobrew use 1.4で1.4が使えるようになりました!
また
gobrewinstall1.3.3gobrew use 1.3.3で1.3.3に使用するバージョンをかえることができます!
ここまでがgobrewをつかったバージョン管理の方法です
またハッシュテーブルを再構築するには
gobrew rehashworkspaceを設置するには
gobrew workspaceset取り消すには
gobrew workspaceunsetで可能になります。
またアップデートは
cd ~./.gobrew/tools/upgrade.shアンインストールは
cd ~./.gobrew/tools/uninstall.shで可能となります、
ちなみにlistコマンドで現在インストールすることのできるバージョンを出すことができるのですが、
% gobrew list++uname-s++tr'[:upper:]''[:lower:]'+platform=darwin++uname-m+'[' x86_64= x86_64']'+arch=amd64+echo'finding Go versions for darwin-amd64'finding Go versionsfordarwin-amd64+url='https://code.google.com/p/go/downloads/list?can=1&num=10000'+go_downloads_list='https://code.google.com/p/go/downloads/list?can=1&num=10000'+grep'<a href="//.*/files/go.*\.tar\.gz'+ curl-s'https://code.google.com/p/go/downloads/list?can=1&num=10000'+sed-e's/<a .*href=['\''"]//'-e's/["'\''].*$//'-e'/^$/ d'+sed-n's/.*files\/\(go.*\.tar\.gz\)/\1/p'+sed-n's/go\(.*\)\.darwin-amd64.*/\1/p'+uniq+sort1.0.31.11.1.11.1.21.1beta11.1beta21.1rc11.1rc21.1rc31.21.2.11.2rc11.2rc21.2rc31.2rc41.2rc5表示されている最初のあたりがかなり謎なのですがこれは仕様なのでしょうか、、、?
今回は色々お騒がせしてしまい、申し訳ないです、、、以上でgobrewによるバージョン管理の記事は終了です。みなさんのお役にたてれば幸いです!
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme