HUGO

Building Hugo DEV from source in Go 1.16

I recently migrated from Linux to macOS and with go1.16.2 installed I noticed the following difference from my previous setup:

In go1.15.3 the command go get -u -v github.com/gohugoio/hugo compiled the latest unreleased Hugo DEV version when executed from within the Go default packages directory.

But with go1.16.2 the same command under the same folder compiled the latest Hugo release and not the DEV version.

After a bit of tinkering, I found out that executing the command from within my local Hugo fork that resides outside the Go packages directory compiles the DEV version.

P.S. Thanks @bep for clearing this up.

3 Likes

On my Macbook I have a ~/go folder outside my usual hugo git.

And I compile the latest DEV code with this:

git pull https://github.com/gohugoio/hugo.git
go install
1 Like

Yes. Same same, yet slightly different. Thanks for sharing.

I’m pretty sure the difference you see is because of the Go version and not the OS used.

1 Like

Yes you are right.

I just checked on Linux I had go1.15.3 linux/amd after updating to go1.16.2 I am seeing the same behaviour as on macOS, with one exception: the previous compiled Hugo Linux binary needs to be deleted because otherwise the version displayed with Hugo version will remain the same as before.

Thanks for the heads up! I have amended the topic title and the first post.

So, a nice new thing in Go 1.16 is that you can now do:

go get -u -v github.com/gohugoio/hugo@v0.76.0

Etc.

1 Like