Hi - I’m using this zsh function to upgrade hugo:
hugodevinstall (){
cd $HOME
echo "==Move current hugo to hugo-prev in case of need to revert=="
mv $HOME/gocode/bin/hugo $HOME/gocode/bin/hugo-prev
echo "==Upgrading Hugo Source=="
go get -u -v github.com/spf13/hugo
echo "==Get newly installed hugo version=="
$HOME/gocode/bin/hugo version
echo "==Compile new hugo=="
cd $HOME/gocode/src/github.com/spf13/hugo/
make hugo
echo "==Get version string and move hugo into position=="
_newhugoverstr=$($HOME/gocode/src/github.com/spf13/hugo/hugo version | awk -F ' ' '{ print $5 }')
mv $HOME/gocode/src/github.com/spf13/hugo/hugo $HOME/gocode/bin/hugo-${_newhugoverstr}
cd $HOME/gocode/bin
ln -sf $HOME/gocode/bin/hugo-${_newhugoverstr} hugo
cd $HOME
echo "==Sanity check - compare versions=="
echo "Expecting: ${_newhugoverstr}"
echo "Actual: "
hugo version
}
I have GOPATH=/Users/rcogley/gocode
, and my go version is 1.8.1. This function script worked when I had not upgraded for a while, but, today I thought I’d run it with the idea that I’d get the latest, but, I think that some things have changed.
This is what it returns when I run it now:
hugodevinstall
==Move current hugo to hugo-prev in case of need to revert==
overwrite /Users/rcogley/gocode/bin/hugo-prev? (y/n [n]) y
==Upgrading Hugo Source==
github.com/spf13/hugo (download)
# cd /Users/rcogley/gocode/src/github.com/spf13/hugo; git pull --ff-only
From https://github.com/spf13/hugo
b332d93e..718c0e14 master -> origin/master
+ b41518ed...92a51a53 release-docs -> origin/release-docs (forced update)
* [new branch] v0.18.1rb -> origin/v0.18.1rb
* [new branch] v0.20.5rb -> origin/v0.20.5rb
* [new branch] v0.20.6rb -> origin/v0.20.6rb
* [new tag] v0.20.5 -> v0.20.5
* [new tag] v0.20.6 -> v0.20.6
error: Your local changes to the following files would be overwritten by merge:
vendor/vendor.json
Please commit your changes or stash them before you merge.
Aborting
Updating b5e32eb6..718c0e14
package github.com/spf13/hugo: exit status 1
0.27s user 0.97s system 51% cpu 2.406 total
==Get newly installed hugo version==
hugodevinstall:7: no such file or directory: /Users/rcogley/gocode/bin/hugo
==Compile new hugo==
go get github.com/kardianos/govendor
govendor sync github.com/spf13/hugo
go build -ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=`git rev-parse --short HEAD 2>/dev/null` -X github.com/spf13/hugo/hugolib.BuildDate=`date +%FT%T%z`" github.com/spf13/hugo
1.25s user 0.66s system 88% cpu 2.165 total
==Get version string and move hugo into position==
overwrite /Users/rcogley/gocode/bin/hugo-v0.21-DEV-B5E32EB6? (y/n [n]) y
==Sanity check - compare versions==
Expecting: v0.21-DEV-B5E32EB6
Actual:
Hugo Static Site Generator v0.21-DEV-B5E32EB6 darwin/amd64 BuildDate: 2017-04-27T19:10:01+09:00
Well, nothing changes and I just want to understand the best practice for getting the latest, doing an upgrade and so on.
Can someone please advise, if you happen to have a stable script for upgrade?
Thank you in advance.