Creating a stable version Hugo from source

Hello,

Using the information from

http://gohugo.io/overview/installing
Installing from source / Get directly from GitHub

The following command’s give me a working hugo executable.

$ mkdir hugo
$ cd hugo

$ export GOPATH=$(pwd)
$ go get -v github.com/spf13/hugo

$ tree -L 1
.
├── bin
├── pkg
└── src
3 directories, 0 files

$ ./bin/hugo version 
Hugo Static Site Generator v0.16-DEV BuildDate: 2016-03-26T13:46:28+01:00

The things is: I like to play around with a stable release. Like v0.15.
Because I don’t know Go or Hugo at the moment.

What should be done to get a stable v0.15 executable and it’s source?
Any help with the right commands is appreciated.

1 Like

It is currently very hard, other than the brew install method (they actually vendor and builds the binary from source), I’m not sure there are any alternatives. The problem is that we don’t vendor our dependencies, so to get an exact build with correct version, you would have to track the hashes of all the dependencies. This is doable, of course, but I’m not sure there are tools ready for this.

We should vendor the dependencies, of course, but it is tempting in the early state of a project to just use the latest and greatest. It saves some management.

Thanks for the quick reply.

Something I have tried from experience with other development languages and git repo. I did clone https://github.com/spf13/hugo.git, and checked out tag v0.15.
That seemed good at first site.

But after

go get -v github.com/spf13/hugo 

I always end up with a src directory that seems to contain the v0.16-DEV sources.
And make does build from that src directory … so it seems to me.

So I am a bit lost, I thought having the right Git tag checkout it would make me the 0.15 version. But I understand it is not that easy.

I must admit I am a bit puzzled about the haven a Git checkout of tag v0.15 of the hugo Git repo and ending up with a src dir containing (I think) source from v0.16-DEV.

But, like I said, I don’t have a lot Go e(build or install) experience.

Other question: is the master branch generally considered stable in Hugo? The thing is that I probably can’t rely on the doc’s then … ?

That shouldn’t happen – if that is the case, Steve added the tags a bit late (after the version strings) – I will check that.

But even with the correct Hugo revision there are, as I said, all the dependencies.

Yes it is generally stable. I am using it for my sites on a daily basis. The released docs is still mostly true, but does not contain the latest, but the good thing is that the docs is also a Hugo site, so:

hugo server -s docs from the root of the Hugo repo will get you the latest docs up and running.

Hugo is of course using GIT and GO. And you can use both of them to your advantage. First GIT: to checkout v15, you use this command:

$ cd hugo
$ git describe --tags
v0.15-428-gbfe8009
$ git checkout -b local v0.15
Switched to a new branch 'local'
$ git describe --tags
v0.15

And once this is done, you can compile like this with GO:

 $ go build -o ~/bin/hugo main.go

This method works, but it has one caveat: the packages in $GOPATH/src/ stay as they are, e.g. they aren’t rewound to what has been used when the original hugo v0.15 has been built. That said: building worked, and running this hugo worked, too.