New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hugo work with Go 1.11 (and Go 1.10) #4784

rjoleary opened this Issue May 27, 2018 · 3 comments


None yet
3 participants

rjoleary commented May 27, 2018

I'm on the Go master branch, Ubuntu 16.04, Linux 4.4.0-127-generic:

% go version
go version devel +65c365b Wed May 23 23:51:30 2018 +0000 linux/amd64

The following (gotten from getting started) runs as expected:

go get
go get -d
cd ${GOPATH:-$HOME/go}/src/
mage vendor

However, running install fails:

% mage install
tpl/tplimpl/template_ast_transformers.go:116:18: cannot range over x.Decl (type bool)
tpl/tplimpl/template_ast_transformers.go:132:10: undefined: parse.VariableNode
tpl/tplimpl/template_ast_transformers.go:133:30: an.Ident undefined (type parse.Node has no field or method Ident)
Error: running "go install -ldflags -X -X" failed with exit code 2

It appears hugo depends on "text/template/parse" which got an API change on Dec 17 which was merged to master in April:

To avoid confusion, rename PipeNode.Decl to PipeNode.Vars, as the
variables may not always be declared after this change.

Renaming Decl to Vars and VariableNode to AssignNode in "template_ast_transformers.go" allowed Hugo to install:

% hugo version
Hugo Static Site Generator v0.42-DEV-D68367C linux/amd64 BuildDate: 2018-05-27T09:03:03-0400

It seems out of the ordinary for Go to have a breaking change. It would be nice to be able to install hugo with Go master.


This comment has been minimized.


bep commented May 27, 2018

Go's master branch is not supported. We will eventually fix this.

@bep bep closed this May 27, 2018

@bep bep changed the title from Could not install with Go's master branch to Make Hugo work with Go 1.11 (and Go 1.10) May 27, 2018

@bep bep reopened this May 27, 2018

@bep bep added this to the v0.42 milestone May 27, 2018

@bep bep modified the milestones: v0.42, v0.43 Jun 5, 2018

@anthonyfok anthonyfok self-assigned this Jun 13, 2018

anthonyfok added a commit to anthonyfok/hugo that referenced this issue Jun 13, 2018


This comment has been minimized.


anthonyfok commented Jun 14, 2018

@rjoleary, Thank you for your report!

PR #4849 (pending review) fixes the compilation issue with the upcoming go1.11.

However, a somewhat unrelated test failed, which @ bep quickly recognize as another behaviour change in go1.11 (nil used to return nothing in go1.10 and before, but not it returns <nil>, and filed golang/go#25875, which upstream will likely fix before the official go1.11 release.

@bep bep closed this in #4849 Jun 14, 2018

bep added a commit that referenced this issue Jun 14, 2018

tpl: Support text/template/parse API change in go1.11
Thanks to @rjoleary for the investigation.

Fixes #4784

This comment has been minimized.


anthonyfok commented Jun 14, 2018

Regarding the escaped <nil> output from html/template in Go tip (pre-Go1.11), i.e. golang/go#25875, upstream has come up with a proposed fix at, pending review and discussion, with a disclaimer at the bottom of the commit message:

DO NOT SUBMIT - we haven't yet decided if this is the right path forward.

Full diff of the proposed fix:

anthonyfok added a commit that referenced this issue Jun 23, 2018

Revert "tpl: Support text/template/parse API change in go1.11"
Go developers have undone the breaking API changes
in the following commit:

commit bedfa4e1c37bd08063865da628f242d27ca06ec4
Author: Daniel Theophanes <>
Date:   Thu Jun 21 10:41:26 2018 -0700

    text/template/parse: undo breaking API changes altered the API for the parse package for
    clarity and consistency. However, the changes also broke the
    API for consumers of the package. This CL reverts the API
    to the previous spelling, adding only a single new exported

    Fixes #25968

    Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f
    Reviewed-by: Daniel Martí <>
    Reviewed-by: Rob Pike <>
    Run-TryBot: Daniel Martí <>
    TryBot-Result: Gobot Gobot <>

See golang/go#25968

This reverts commit 9f27091.

Closes #4784
Fixes #4873
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment