Codemap:一頁式互動式 Go 模組地圖工具
Show HN: Codemap – one-page interactive map of any Go repository
重點導讀
Codemap 是一個單頁 HTML 工具,能將 Go 模組中的所有包、依賴關係與函式視覺化。
- 使用方式:在模組目錄下執行
go run github.com/peterretief/codemap@latest -o code-map.html,即可產生code-map.html,在瀏覽器開啟即可檢視。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
正文
One HTML page that maps a Go module: every package, what it builds on within the module, and the functions in each of its files. Search it, click a package to see what it uses and what uses it, and, for a module on GitHub, jump to any function's line. Tests are left out.
Example: yggstore's map, 40 packages and 1,850 functions.
Use it
In your module's folder, with Go 1.24 or later:
go run github.com/peterretief/codemap@latest -o code-map.html
Then open code-map.html in a browser. It's one file with nothing to serve,
so it can go on any website. -root DIR maps another folder.
In GitHub Actions
- uses: actions/checkout@v4 - uses: peterretief/codemap@v0.1.0 with: output: code-map.html - uses: actions/upload-artifact@v4 with: name: code-map path: code-map.html
How it reads the map
- Each row builds only on the rows below it, so the foundations are at the bottom and your commands at the top.
- Wider boxes have more functions, and colours are top-level folders.
internal/is left off names.vendor,testdataand folders with their owngo.modare left out.- The page loads its fonts from Google Fonts, and falls back to system fonts without them.
來源: Hacker News (official RSS) (github.com)
開啟原文