15 releases (4 breaking)
Uses new Rust 2024
| new 0.9.3 | Mar 28, 2026 |
|---|---|
| 0.9.2 | Mar 21, 2026 |
| 0.9.0 | Feb 23, 2026 |
| 0.8.0 | Feb 23, 2026 |
| 0.5.2 | Dec 27, 2025 |
#684 in Text editors
Used in deps-lsp
375KB
8K
SLoC
deps-go
Go modules support for deps-lsp.
This crate is part of the deps-lsp workspace. It provides parsing and registry integration for Go's module ecosystem and implements deps_core::Ecosystem.
Features
- go.mod parsing — Parse all directives with byte-accurate position tracking
- go.sum lock file — Extract resolved versions from
go.sum - Directive support — Handle
require,replace,exclude, andretractdirectives - Indirect dependencies — Detect and mark
// indirectannotations - Pseudo-versions — Parse and validate the
v0.0.0-YYYYMMDDHHMMSS-hashformat - proxy.golang.org — Fetch module versions from the Go module proxy
- Module path escaping — Proper URL encoding for uppercase characters per Go spec
Installation
[dependencies]
deps-go = "0.9.3"
[!IMPORTANT] Requires Rust 1.89 or later.
Usage
use deps_go::{parse_go_mod, GoRegistry};
let dependencies = parse_go_mod(content, &uri)?;
let registry = GoRegistry::new(cache);
let versions = registry.get_versions("github.com/gin-gonic/gin").await?;
Supported directives
require
require github.com/gin-gonic/gin v1.9.1
require (
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.5.0 // indirect
)
replace
replace github.com/old/module => github.com/new/module v1.0.0
replace github.com/local/module => ../local/module
exclude
exclude github.com/pkg/module v1.2.3
Pseudo-version support
Handles Go's pseudo-version format for unreleased commits:
v0.0.0-20191109021931-daa7c04131f5
Extracts base version and timestamp for display.
License
Dependencies
~15–25MB
~356K SLoC