Skip to content
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

Closed
rjoleary opened this issue May 27, 2018 · 4 comments · Fixed by #4849
Closed

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

rjoleary opened this issue May 27, 2018 · 4 comments · Fixed by #4849
Assignees
Labels
Milestone

Comments

@rjoleary
Copy link

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 github.com/magefile/mage
go get -d github.com/gohugoio/hugo
cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo
mage vendor

However, running install fails:

% mage install
# github.com/gohugoio/hugo/tpl/tplimpl
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 github.com/gohugoio/hugo/hugolib.CommitHash=d68367c -X github.com/gohugoio/hugo/hugolib.BuildDate=2018-05-27T08:47:25-0400 github.com/gohugoio/hugo" 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.

@bep
Copy link
Member

bep commented May 27, 2018

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

@bep bep closed this as completed May 27, 2018
@bep bep changed the title Could not install with Go's master branch 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
@anthonyfok
Copy link
Member

@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 as completed in #4849 Jun 14, 2018
bep pushed a commit that referenced this issue Jun 14, 2018
@anthonyfok
Copy link
Member

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 https://go-review.googlesource.com/c/go/+/118835, 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: https://go.googlesource.com/go/+/46c521a7ee4d04971a828d0c0f9d698e1641344d%5E%21/

anthonyfok added a commit that referenced this issue Jun 23, 2018
Go developers have undone the breaking API changes
in the following commit:

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

    text/template/parse: undo breaking API changes

    golang.org/cl/84480 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
    symbol.

    Fixes #25968

    Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f
    Reviewed-on: https://go-review.googlesource.com/120355
    Reviewed-by: Daniel Martí <[email protected]>
    Reviewed-by: Rob Pike <[email protected]>
    Run-TryBot: Daniel Martí <[email protected]>
    TryBot-Result: Gobot Gobot <[email protected]>

See golang/go#25968

This reverts commit 9f27091.

Closes #4784
Fixes #4873
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants