| name | dependency-management |
| description | Use when adding, removing, or updating Go/Rust dependencies. Enforces using go/cargo commands instead of direct file edits. |
Dependency Management
Enforces using official package manager commands instead of direct file edits for dependency changes.
When to Use
- Adding new Go dependencies
- Adding new Rust dependencies
- Removing Go/Rust dependencies
- Updating dependency versions
The Rule
NEVER edit go.mod, go.sum, or Cargo.toml directly.
Go Dependencies
Add/Update:
go get github.com/pkg/example@latest
go add ./...
Remove (remove import first, then):
go mod tidy
Install specific version:
go get github.com/pkg/example@v1.2.3
Rust Dependencies
Add:
cargo add serde --features derive
cargo add tokio --features "full"
cargo add anyhow
Add dev/test dependency:
cargo add --dev mockall
cargo add --test serde_json
Remove:
cargo remove unused_crate
Update:
cargo update
cargo update package_name
Workflow
- Identify the dependency needed
- Run the appropriate
go get / cargo add command
- Verify
go.mod / Cargo.toml updated automatically
- Run lint checks (
go mod verify / cargo check)
- Commit the changes
Project-Specific Notes
- Go projects:
go/installer/, tools/bin2pb/, sni_tester/
- Rust projects:
rust/tgbot/, rust/version-sync/
- Run from the project root (where
go.mod or Cargo.toml lives)