Show HN: Codemap – one-page interactive map of any Go repository github.com · 24...
Show HN @show
Show HN: Codemap – one-page interactive map of any Go repository github.com · 24 points · 6 comments · HN thread
TL;DR Codemap is a Go CLI that generates a single self-contained HTML page mapping a Go module: every package, its dependencies within the module, and the functions in each file. The page is searchable, lets you click a package to see what it uses and what uses it, and links functions to their GitHub lines for modules hosted there. It is shown as a Show HN post with 24 points and 6 comments.
- Run with go run github.com/peterretief/codemap@latest -o code-map.html from a module folder (Go 1.24 or later), then open the file in a browser.
- Output is one HTML file with no server needed, so it can be hosted on any website.
- Example map of yggstore: 40 packages and 1,850 functions.
- Rows are layered so each package builds only on rows below it, with foundations at the bottom; wider boxes mean more functions and colours mark top-level folders.
- Tests, vendor, testdata and folders with their own go.mod are excluded; internal/ is dropped from names.
- A GitHub Action (peterretief/codemap@v0.1.0) is provided to generate the map in CI and upload it as an artifact.
- The page loads fonts from Google Fonts and falls back to system fonts.
Discussion Commenters are generally positive and treat the tool as a practical visualization for understanding Go codebases. Discussion centers on three threads: whether the Go-only focus is structural or a choice, how the author validated accuracy against tools like ctags and tree-sitter, and whether hosted or agent-oriented use cases make sense. The mood is friendly and curious, with a few technical questions and a couple of suggestions for extensions.
- Useful for browsing and understanding Go projects (many): Several commenters say they would use it, including one who plans to add it alongside godoc on open source projects. The tool is seen as a clear, lightweight way to see package structure.
- Wants a hosted version for any repository (some): One commenter suggests a pkg.go.dev-style service where any repository URL can be entered to generate the map without running the tool locally.
- Could help AI agents inspect codebases (some): One commenter suggests a CLI form that agents could use to inspect code efficiently. A reply argues agents can already use language servers for structure and that hooks to keep them honest may be a better fit.
- Asks about validation and accuracy (a few): One commenter asks what validation strategy was used, noting that golden repos helped prevent drift in their own similar project, and reports comparing function detection and precision and recall against ctags and tree-sitter.
- Asks whether Go-only scope is intentional (a few): One commenter wonders whether the Go focus is structural or a deliberate choice, and believes the approach could apply to other languages.
Links from the comments
#golang #codeVisualization #developerTools #showHN #staticAnalysis