Hello everyone
Currently (last months) I can’t get my Hugo project to run consistently with the normal release (probably bug in own template code), but I don’t get any error only a go panic.
I was happy to discover that a wise person once said:
Short after I checked-out GitHub - bep/hugo at fix/templ-race-workarond, which gives me an actual error message (see below). Does any of you wonderful people that know the language/hugo get what I do wrong and give me a hint where to look what to debug?
❯ hugo serve
Building sites … panic: html/template: cannot Clone "" after it has executed
goroutine 135 [running]:
github.com/gohugoio/hugo/tpl/internal/go_templates/htmltemplate.Must(...)
/home/fhungenberg/github/hugo-templ-race-workaround/tpl/internal/go_templates/htmltemplate/template.go:373
github.com/gohugoio/hugo/tpl/tplimpl.(*templateNamespace).createPrototypes(0xc000a4c870)
/home/fhungenberg/github/hugo-templ-race-workaround/tpl/tplimpl/template.go:809 +0xa5
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).MarkReady.func1()
/home/fhungenberg/github/hugo-templ-race-workaround/tpl/tplimpl/template.go:250 +0x45
sync.(*Once).doSlow(0x0, 0x0)
/usr/local/go/src/sync/once.go:68 +0xd2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:59
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).MarkReady(0x0)
/home/fhungenberg/github/hugo-templ-race-workaround/tpl/tplimpl/template.go:247 +0x65
github.com/gohugoio/hugo/hugolib.newHugoSites.func2()
/home/fhungenberg/github/hugo-templ-race-workaround/hugolib/hugo_sites.go:336 +0x7d
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/init.go:97 +0xb0
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0x0, 0xc000cbbac8)
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/once.go:53 +0x135
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc000259da0)
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/init.go:79 +0x4a
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/init.go:102 +0x165
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc000cbbb58, 0xe688c5)
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/once.go:53 +0x135
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc000259c20)
/home/fhungenberg/github/hugo-templ-race-workaround/lazy/init.go:79 +0x4a
github.com/gohugoio/hugo/hugolib.(*HugoSites).render(0xc0007a46e0, 0xc000ac29c0)
/home/fhungenberg/github/hugo-templ-race-workaround/hugolib/hugo_sites_build.go:279 +0x4c
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func4()
/home/fhungenberg/github/hugo-templ-race-workaround/hugolib/hugo_sites_build.go:149 +0x2a
runtime/trace.WithRegion({0x1ced7e0, 0xc000c90d50}, {0x15b8b23, 0x6}, 0xc000cbbe80)
/usr/local/go/src/runtime/trace/annotation.go:141 +0x104
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc0007a46e0, {0x0, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ...)
/home/fhungenberg/github/hugo-templ-race-workaround/hugolib/hugo_sites_build.go:151 +0x51c
github.com/gohugoio/hugo/commands.(*commandeer).buildSites(...)
/home/fhungenberg/github/hugo-templ-race-workaround/commands/hugo.go:743
github.com/gohugoio/hugo/commands.(*commandeer).fullBuild.func3()
/home/fhungenberg/github/hugo-templ-race-workaround/commands/hugo.go:316 +0x65
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/fhungenberg/go/pkg/mod/golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e/errgroup/errgroup.go:57 +0x67
created by golang.org/x/sync/errgroup.(*Group).Go
/home/fhungenberg/go/pkg/mod/golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e/errgroup/errgroup.go:54 +0x92
Hugo: Hugo Static Site Generator v0.74.0-DEV linux/amd64 BuildDate: unknown (installed via go)
Go: go version go1.17.1 linux/amd64
Env: Debian 10 (4.19.0-17-amd64)
What I’ve tried and failed: removing all ""
from code , using different go and hugo versions.
Error message when Hugo is build from master:
https://pastebin.com/pjgnWkF0
(discourse line limitation )