gormでModelのenumの設定をする書き方
Goで依存ライブラリのバージョンを上げる
別のPCでgo get
で取得したライブラリのバージョンが違っていたので、ビルドが失敗した。
ライブラリのバージョンを合わせるときに、つまずいたのでその時のメモ。
go version go version go1.7.3 darwin/amd64
go help
で見たときに、update
の項目がなかった。
ネットで調べたらgo get -u
というoptionがあるようだ。
実際に使ってみたら、pullできないと。。。!?
go get -u github.com/jinzhu/gorm # cd $GOPATH/github.com/jinzhu/gorm; git pull --ff-only You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> package github.com/jinzhu/gorm: exit status 1
コマンドを調べてみたら。。。
go help get ≈ The -u flag instructs get to use the network to update the named packages and their dependencies. By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages.
既存のパッケージの更新を探すものではないと。。。
but does not use it to look for updates to existing packages.
結局やり方がわからなかったので、 masterをcheckoutをして調整をした。。。
cd $GOPATH/github.com/jinzhu/gorm git checkout master git pull --ff-only
GVMでGolangのバージョン管理の導入メモ
Go1.4を使用できるように設定
Go1.5以上をcompileするときに必要
git clone -b release-branch.go1.4 https://go.googlesource.com/go $HOME/go1.4 cd $HOME/go1.4/src ./make.bash echo "export GOROOT_BOOTSTRAP=$HOME/go1.4" >> ~/.bash_profile
gvmをinstallする
1.7.3を使用するように設定
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) [[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm" gvm install go1.7.3 gvm use go1.7.3 --default
GOPATHを設定
HOME/Workspaces/go/ が僕のgoの作業スペースになっている
echo export GOPATH=$HOME/Workspaces/go/ >> ~/.bash_profile echo export PATH=$PATH:$GOPATH/bin >> ~/.bash_profile