Panic with cold mod cache
tie opened this issue · 1 comments
tie commented
When running golds on go.pact.im/x source code with “cold” local modules cache, golds panics on first attempt.
$ go clean -modcache
$ golds -dir=build/doc -gen -silent -footer=simple -wdpkgs-listing=solo all
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
go101.org/golds/code.(*CodeAnalyzer).confirmPackageModules(0xc0000d0000, {0xc000128060?, 0x1?, 0x3?}, 0x0, {{0xc00013c260, 0x16}, {0xc00013c260, 0x1a}, {0xc00013c260, ...}, ...}, ...)
go101.org/golds@v0.4.8/code/code-parse.go:544 +0x1e6a
go101.org/golds/code.(*CodeAnalyzer).ParsePackages(0xc0000d0000, 0xc00010c420, 0xc000146000?, {{0xc00013c260, 0x16}, {0xc00013c260, 0x1a}, {0xc00013c260, 0x1e}, {0xc000134000, ...}}, ...)
go101.org/golds@v0.4.8/code/code-parse.go:466 +0x19b3
go101.org/golds/internal/server.(*docServer).analyze(0xc000146000, {0xc000128060, 0x1, 0xa92ad8?}, {{0x9ac4ba, 0x6}, {0x0, 0x0}, 0x0, 0x0, ...}, ...)
go101.org/golds@v0.4.8/internal/server/server.go:295 +0x43c
go101.org/golds/internal/server.GenDocs({{0x9ac4ba, 0x6}, {0x0, 0x0}, 0x0, 0x0, 0x0, 0x0, 0x0, {0x9aa68c, ...}, ...}, ...)
go101.org/golds@v0.4.8/internal/server/tool_gen-docs.go:506 +0x377
go101.org/golds/internal/app.run()
go101.org/golds@v0.4.8/internal/app/run.go:234 +0xf65
go101.org/golds/internal/app.Main(...)
go101.org/golds@v0.4.8/internal/app/run.go:33
main.main()
go101.org/golds@v0.4.8/main.go:10 +0x53
And subsequent run succeeds. 🙃
$ golds -dir=build/doc -gen -silent -footer=simple -wdpkgs-listing=solo all
tool_gen-docs.go:630: Docs are generated in build/doc.
tool_gen-docs.go:639: Run the following command to view the docs:
tool_gen-docs.go:640: golds -dir=build/doc