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

Panic with cold mod cache #28

Closed
tie opened this issue Apr 25, 2022 · 1 comment
Closed

Panic with cold mod cache #28

tie opened this issue Apr 25, 2022 · 1 comment

Comments

@tie
Copy link

tie commented Apr 25, 2022

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
@zigo101
Copy link
Collaborator

zigo101 commented Apr 25, 2022

@tie
Thanks for reporting this problem!

In fact, the problem confused me for a long time.
It should be fixed version v0.4.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants