Summary
Adds go: and golang: prefixes to fetch Go module source code via proxy.golang.org. Follows the existing registry pattern used by npm, PyPI, and crates.io.
Usage
opensrc path go:golang.org/x/tools
opensrc path golang:github.com/gin-gonic/gin
opensrc path go:golang.org/x/tools@v0.43.0Also adds --go flag to opensrc clean and shows Go modules in opensrc list.
Demo
How it works
The Go module proxy at proxy.golang.org returns a JSON response with the canonical git repository URL in its Origin.URL field. For golang.org/x/* modules hosted on go.googlesource.com, the URL is rewritten to the official GitHub mirror at github.com/golang/* (the cache system expects host/owner/repo structure).
For modules without Origin data (older versions), the git URL is derived from the module path.
Changes
go.rs- New registry module:parse_go_specandresolve_go_modulefollowing the existing patternmod.rs- AddGovariant toRegistryenum,go:andgolang:prefixes, extendparse_package_specandresolve_packagemain.rs- Add--goflag to clean commandlist.rs- Add Go modules to the registries display and empty-state help text
Testing
8 new unit tests covering spec parsing, googlesource URL normalization, and module path resolution. All 40 tests pass (38 existing + 2 new googlesource tests + 6 existing Go tests = 40 with --test-threads=1).
cargo test --manifest-path packages/opensrc/cli/Cargo.toml -- --test-threads=1
cargo clippy --manifest-path packages/opensrc/cli/Cargo.toml -- -D warnings
cargo fmt --manifest-path packages/opensrc/cli/Cargo.toml --checkThis contribution was developed with AI assistance (Claude Code).
@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.