DevTrends开发者趋势
主题色

msuozzo /

go-git2

go-git2 is a Go git library (read-only for now) using libgit2 transpiled to Go with wasm2go. As a result, it builds with CGO_ENABLED=0 and cross-compiles without a C toolchain. It supports 64-bit Linux, macOS, and Window…

DT软件开发DT命令行工具DT库 / SDKDTLinuxDTmacOSDTWindows

关于

go-git2 is a Go git library (read-only for now) using libgit2 transpiled to Go with wasm2go. As a result, it builds with CGO_ENABLED=0 and cross-compiles without a C toolchain. It supports 64-bit Linux, macOS, and Windows today. While go-git has been great for my uses, its performance on larger repos and quirky differences from the git CLI output have been tricky to work with. I'm a huge fan of wasm2go and go-sqlite3 and wanted to apply the same approach and see what could be done. Incredibly happy with the results thus far, with 10-100x improvements on my real-world use cases. On the django repo, finding commits touching a file goes from 40s with go-git to 350ms, against 255ms for git itself. And the only unsafe is in wasm2go's bounds-checked memory accesses! The API follows go-git v5, so read-only code is mostly a drop-in (still a few constructs to port). Write support is down the road. The main module is MIT and the libgit2 module keeps the upstream license (GPLv2 w/ linking exception). Give it a go!

收录记录

  1. Show HN

    2026年10月14日 · 1 次收录

讨论这个产品